mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
pulse: avoid blocking in epoll
When the custom poll function told us there is activity on the epoll fd, don't do a blocking wait on the epoll fd. It might be possible that the active fd is removed and then we would block forever. Fixes #349
This commit is contained in:
parent
b50929d200
commit
0265514023
1 changed files with 4 additions and 2 deletions
|
|
@ -327,7 +327,7 @@ static int usec_to_timeout(pa_usec_t u)
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pa_mainloop_poll(pa_mainloop *m)
|
int pa_mainloop_poll(pa_mainloop *m)
|
||||||
{
|
{
|
||||||
int res;
|
int res, timeout;
|
||||||
bool do_iterate;
|
bool do_iterate;
|
||||||
|
|
||||||
if (m->quit)
|
if (m->quit)
|
||||||
|
|
@ -344,13 +344,15 @@ int pa_mainloop_poll(pa_mainloop *m)
|
||||||
usec_to_timeout(m->timeout),
|
usec_to_timeout(m->timeout),
|
||||||
m->poll_func_userdata);
|
m->poll_func_userdata);
|
||||||
do_iterate = res == 1 && SPA_FLAG_IS_SET(fds[0].revents, POLLIN);
|
do_iterate = res == 1 && SPA_FLAG_IS_SET(fds[0].revents, POLLIN);
|
||||||
|
timeout = 0;
|
||||||
} else {
|
} else {
|
||||||
do_iterate = true;
|
do_iterate = true;
|
||||||
|
timeout = m->timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_iterate) {
|
if (do_iterate) {
|
||||||
pw_loop_enter(m->loop);
|
pw_loop_enter(m->loop);
|
||||||
res = pw_loop_iterate(m->loop, m->timeout);
|
res = pw_loop_iterate(m->loop, timeout);
|
||||||
pw_loop_leave(m->loop);
|
pw_loop_leave(m->loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue