summaryrefslogtreecommitdiffstats
path: root/src/pulse/thread-mainloop.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2009-08-16 21:25:48 +0300
committerTanu Kaskinen <tanuk@iki.fi>2009-08-16 21:25:48 +0300
commitbcaba0b1b43d6a1b32aadfa98860f40b2c93e136 (patch)
tree6bd0d60a8fa822bfd688b90d062d0f73eee2e47e /src/pulse/thread-mainloop.c
parent2bb3eef414f80189cf6af6cd66c519630e4c0a43 (diff)
parent01e4b61a910afdd21f860fadbe98075735c2bf51 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work
Conflicts: src/Makefile.am src/daemon/daemon-conf.c src/daemon/daemon.conf.in src/modules/module-stream-restore.c src/pulse/client-conf.c src/pulsecore/namereg.c
Diffstat (limited to 'src/pulse/thread-mainloop.c')
-rw-r--r--src/pulse/thread-mainloop.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index 6916d867..a2b98ce1 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -51,7 +51,7 @@
struct pa_threaded_mainloop {
pa_mainloop *real_mainloop;
- int n_waiting;
+ int n_waiting, n_waiting_for_accept;
pa_thread* thread;
pa_mutex* mutex;
@@ -190,8 +190,12 @@ void pa_threaded_mainloop_signal(pa_threaded_mainloop *m, int wait_for_accept) {
pa_cond_signal(m->cond, 1);
- if (wait_for_accept && m->n_waiting > 0)
- pa_cond_wait(m->accept_cond, m->mutex);
+ if (wait_for_accept) {
+ m->n_waiting_for_accept ++;
+
+ while (m->n_waiting_for_accept > 0)
+ pa_cond_wait(m->accept_cond, m->mutex);
+ }
}
void pa_threaded_mainloop_wait(pa_threaded_mainloop *m) {
@@ -214,6 +218,9 @@ void pa_threaded_mainloop_accept(pa_threaded_mainloop *m) {
/* Make sure that this function is not called from the helper thread */
pa_assert(!m->thread || !pa_thread_is_running(m->thread) || !in_worker(m));
+ pa_assert(m->n_waiting_for_accept > 0);
+ m->n_waiting_for_accept --;
+
pa_cond_signal(m->accept_cond, 0);
}