]> code.delx.au - pulseaudio/commitdiff
thread-mq: never drop queued messages for the main loop
authorLennart Poettering <lennart@poettering.net>
Fri, 14 Aug 2009 02:18:23 +0000 (04:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 14 Aug 2009 02:18:28 +0000 (04:18 +0200)
Previously we might have dropped messages from IO trheads to the main
thread. This tuend out to be problematic since this cause SHM release
messages to be lost. More visibly however this could cause playback
freezing when moving streams between sinks and removing the old sink
right away.

src/pulsecore/thread-mq.c

index 34f92a7e39040fe2fe010638a44f5793f1e9de82..ec67ae87157bdeb51c1f0dee7690f723e081887a 100644 (file)
@@ -104,6 +104,13 @@ void pa_thread_mq_init(pa_thread_mq *q, pa_mainloop_api *mainloop, pa_rtpoll *rt
 void pa_thread_mq_done(pa_thread_mq *q) {
     pa_assert(q);
 
+    /* Since we are called from main context we can be sure that the
+     * inq is empty. However, the outq might still contain messages
+     * for the main loop, which we need to dispatch (e.g. release
+     * msgs, other stuff). Hence do so. */
+
+    pa_asyncmsgq_flush(q->outq, TRUE);
+
     q->mainloop->io_free(q->read_event);
     q->mainloop->io_free(q->write_event);
     q->read_event = q->write_event = NULL;