mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
handle EINTR and EAGAIN
Just do the call again instead of failing or logging an error. Fixes #358
This commit is contained in:
parent
395a30b5d6
commit
e094640c7b
8 changed files with 33 additions and 12 deletions
|
|
@ -1078,11 +1078,17 @@ static inline uint32_t cycle_run(struct client *c)
|
|||
struct pw_node_activation *driver = c->rt.driver_activation;
|
||||
|
||||
/* this is blocking if nothing ready */
|
||||
if (SPA_UNLIKELY(read(fd, &cmd, sizeof(cmd)) != sizeof(cmd))) {
|
||||
pw_log_warn(NAME" %p: read failed %m", c);
|
||||
if (errno == EWOULDBLOCK)
|
||||
return 0;
|
||||
} else if (SPA_UNLIKELY(cmd > 1))
|
||||
while (true) {
|
||||
if (SPA_UNLIKELY(read(fd, &cmd, sizeof(cmd)) != sizeof(cmd))) {
|
||||
if (errno == EAGAIN || errno == EINTR)
|
||||
continue;
|
||||
if (errno == EWOULDBLOCK)
|
||||
return 0;
|
||||
pw_log_warn(NAME" %p: read failed %m", c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (SPA_UNLIKELY(cmd > 1))
|
||||
pw_log_warn(NAME" %p: missed %"PRIu64" wakeups", c, cmd - 1);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue