handle EINTR and EAGAIN

Just do the call again instead of failing or logging an error.

Fixes #358
This commit is contained in:
Wim Taymans 2020-11-02 14:51:07 +01:00
parent 395a30b5d6
commit e094640c7b
8 changed files with 33 additions and 12 deletions

View file

@ -1654,11 +1654,14 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
static void io_event_cb(pa_mainloop_api*ea, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata)
{
int res;
pa_context *c = userdata;
if (events & PA_IO_EVENT_INPUT) {
pw_log_debug("%p: iterate loop %p", c, c->loop);
pw_loop_enter(c->loop);
pw_loop_iterate(c->loop, -1);
do {
res = pw_loop_iterate(c->loop, 0);
} while (res == -EINTR || res == -EAGAIN);
pw_loop_leave(c->loop);
}
}

View file

@ -53,7 +53,9 @@ static gboolean source_dispatch (GSource *source, GSourceFunc callback, gpointer
int result;
pw_loop_enter (s->loop);
result = pw_loop_iterate (s->loop, 0);
do {
result = pw_loop_iterate (s->loop, 0);
} while (result == -EINTR || result == -EAGAIN);
pw_loop_leave (s->loop);
if (result < 0)

View file

@ -352,7 +352,9 @@ int pa_mainloop_poll(pa_mainloop *m)
if (do_iterate) {
pw_loop_enter(m->loop);
res = pw_loop_iterate(m->loop, timeout);
do {
res = pw_loop_iterate(m->loop, timeout);
} while (res == -EINTR || res == -EAGAIN);
pw_loop_leave(m->loop);
}