aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-01 07:13:21 +0200
committerMax Kellermann <max@duempel.org>2011-09-01 07:13:21 +0200
commit8b0b4ff0860ea93850c2f44e72e8a8a5de05e13b (patch)
treeda2adaaa75382333d934869b530ae416a922baf1 /src/output_control.h
parent60f7ff3de594ef6b54a61b6ad630819ce026c760 (diff)
downloadmpd-8b0b4ff0860ea93850c2f44e72e8a8a5de05e13b.tar.gz
mpd-8b0b4ff0860ea93850c2f44e72e8a8a5de05e13b.tar.xz
mpd-8b0b4ff0860ea93850c2f44e72e8a8a5de05e13b.zip
output_thread: reimplement CANCEL synchronization
The output thread could hang indefinitely after finishing CANCEL, because it could have missed the signal while the output was not unlocked in ao_command_finished(). This patch removes the wait() call after CANCEL, and adds the flag "allow_play" instead. While this flag is set, playback is skipped. With this flag, there will not be any excess wait() call after the pipe has been cleared. This patch fixes a bug that causes mpd to discontinue playback after seeking, due to the race condition described above.
Diffstat (limited to 'src/output_control.h')
-rw-r--r--src/output_control.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/output_control.h b/src/output_control.h
index 7f4f4a53c..2b88d4103 100644
--- a/src/output_control.h
+++ b/src/output_control.h
@@ -70,6 +70,11 @@ void audio_output_pause(struct audio_output *ao);
void
audio_output_drain_async(struct audio_output *ao);
+/**
+ * Clear the "allow_play" flag and send the "CANCEL" command
+ * asynchronously. To finish the operation, the caller has to set the
+ * "allow_play" flag and signal the thread.
+ */
void audio_output_cancel(struct audio_output *ao);
void audio_output_close(struct audio_output *ao);