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

@ -1345,6 +1345,8 @@ int sm_media_session_roundtrip(struct sm_media_session *sess)
pw_loop_enter(loop);
while (!done) {
if ((res = pw_loop_iterate(loop, -1)) < 0) {
if (res == -EINTR || res == -EAGAIN)
continue;
pw_log_warn(NAME" %p: iterate error %d (%s)",
loop, res, spa_strerror(res));
break;

View file

@ -43,7 +43,7 @@ int pw_data_loop_wait(struct pw_data_loop *this, int timeout)
break;
}
if ((res = pw_loop_iterate(this->loop, timeout)) < 0) {
if (errno == EINTR)
if (res == -EINTR || res == -EAGAIN)
continue;
}
break;
@ -77,7 +77,7 @@ static void *do_loop(void *user_data)
while (this->running) {
if ((res = pw_loop_iterate(this->loop, -1)) < 0) {
if (errno == EINTR)
if (res == -EINTR || res == -EAGAIN)
continue;
pw_log_error(NAME" %p: iterate error %d (%s)",
this, res, spa_strerror(res));

View file

@ -153,9 +153,12 @@ int pw_main_loop_run(struct pw_main_loop *loop)
loop->running = true;
pw_loop_enter(loop->loop);
while (loop->running) {
if ((res = pw_loop_iterate(loop->loop, -1)) < 0)
if ((res = pw_loop_iterate(loop->loop, -1)) < 0) {
if (res == -EINTR || res == -EAGAIN)
continue;
pw_log_warn(NAME" %p: iterate error %d (%s)",
loop, res, spa_strerror(res));
}
}
pw_loop_leave(loop->loop);
return res;

View file

@ -238,9 +238,12 @@ static void *do_loop(void *user_data)
pw_loop_enter(this->loop);
while (this->running) {
if ((res = pw_loop_iterate(this->loop, -1)) < 0)
if ((res = pw_loop_iterate(this->loop, -1)) < 0) {
if (res == -EINTR || res == -EAGAIN)
continue;
pw_log_warn(NAME" %p: iterate error %d (%s)",
this, res, spa_strerror(res));
}
}
pw_log_debug(NAME" %p: leave thread", this);
pw_loop_leave(this->loop);