mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: use semaphore semantics for the eventfd
Because we write from multiple threads, a thread might write a second wakeup and a concurrent thread might remove all wakeups before seeing it's error and retrying, which would leave the eventfd in a wrong state. With a semaphore, things balance out and the eventfd always ends up in a consistent state.
This commit is contained in:
parent
a30c27dce0
commit
6ab10237cd
1 changed files with 2 additions and 1 deletions
|
|
@ -1262,7 +1262,8 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp,
|
||||||
pw_core_add_listener(pw->core, &pw->core_listener, &core_events, pw);
|
pw_core_add_listener(pw->core, &pw->core_listener, &core_events, pw);
|
||||||
pw_thread_loop_unlock(pw->main_loop);
|
pw_thread_loop_unlock(pw->main_loop);
|
||||||
|
|
||||||
pw->fd = spa_system_eventfd_create(pw->system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
pw->fd = spa_system_eventfd_create(pw->system,
|
||||||
|
SPA_FD_EVENT_SEMAPHORE | SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
||||||
if (pw->fd < 0) {
|
if (pw->fd < 0) {
|
||||||
err = pw->fd;
|
err = pw->fd;
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue