Commit 64dacd17 authored by Max Kellermann's avatar Max Kellermann

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().
parent 625e4755
ver 0.15.13 (2010/??/??) ver 0.15.13 (2010/??/??)
* output_thread: fix race condition after CANCEL command
ver 0.15.12 (2010/07/20) ver 0.15.12 (2010/07/20)
......
...@@ -268,6 +268,16 @@ static gpointer audio_output_task(gpointer arg) ...@@ -268,6 +268,16 @@ static gpointer audio_output_task(gpointer arg)
ao->chunk = NULL; ao->chunk = NULL;
if (ao->open) if (ao->open)
ao_plugin_cancel(ao->plugin, ao->data); 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); ao_command_finished(ao);
/* the player thread will now clear our music /* the player thread will now clear our music
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment