aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-08-19 11:05:24 +0200
committerMax Kellermann <max@duempel.org>2010-08-19 11:05:24 +0200
commit64dacd175ac7279b4b019c2e653d85007d71efb0 (patch)
treed6420431e7cc5f1a723e4055bdcad8edc57a12c7 /src
parent625e4755d1c59e537dc122a540d3c21de962c3d1 (diff)
downloadmpd-64dacd175ac7279b4b019c2e653d85007d71efb0.tar.gz
mpd-64dacd175ac7279b4b019c2e653d85007d71efb0.tar.xz
mpd-64dacd175ac7279b4b019c2e653d85007d71efb0.zip
output_thread: fix race condition after CANCEL command
Clear the notification before finishing the CANCEL command, so the notify_wait() after that will always wait for the right notification, sent by audio_output_all_cancel().
Diffstat (limited to '')
-rw-r--r--src/output_thread.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/output_thread.c b/src/output_thread.c
index 770b377e8..e652eae57 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -268,6 +268,16 @@ static gpointer audio_output_task(gpointer arg)
ao->chunk = NULL;
if (ao->open)
ao_plugin_cancel(ao->plugin, ao->data);
+
+ /* we must clear the notification now, because
+ the notify_wait() call below must wait
+ until audio_output_all_cancel() has cleared
+ the pipe; if another notification happens
+ to be still pending, we get a race
+ condition with a crash or an assertion
+ failure */
+ notify_clear(&ao->notify);
+
ao_command_finished(ao);
/* the player thread will now clear our music