[pulseaudio-discuss] [PATCH 4/5] mainloop: Write to the wakeup pipe unconditionally when waking up the mainloop.

Tanu Kaskinen tanu.kaskinen at digia.com
Mon Apr 2 05:01:05 PDT 2012


If the mainloop is just about to enter polling, but m->state
is not POLLING yet when some other thread calls
pa_mainloop_wakeup(), the mainloop will not be woken up.
It's safe to write to the wakeup pipe at any time, so let's
just remove the check.
---
 src/pulse/mainloop.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 160ba9c..8ac8f06 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -774,10 +774,8 @@ void pa_mainloop_wakeup(pa_mainloop *m) {
     char c = 'W';
     pa_assert(m);
 
-    if (m->state == STATE_POLLING) {
-        pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type);
-        pa_atomic_store(&m->wakeup_requested, TRUE);
-    }
+    pa_write(m->wakeup_pipe[1], &c, sizeof(c), &m->wakeup_pipe_type);
+    pa_atomic_store(&m->wakeup_requested, TRUE);
 }
 
 static void clear_wakeup(pa_mainloop *m) {
-- 
1.7.8



More information about the pulseaudio-discuss mailing list