aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_internal.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-25 17:07:15 +0100
committerMax Kellermann <max@duempel.org>2009-03-25 17:07:15 +0100
commit4dbf73d88bf5ab2da154ac2f537aa28a67c5f8b6 (patch)
tree56158acb8882f2879af37ed4345dc571c272150c /src/output_internal.h
parent71cd24954a34bc9fb0fdf6505616ba79b8320a5a (diff)
downloadmpd-4dbf73d88bf5ab2da154ac2f537aa28a67c5f8b6.tar.gz
mpd-4dbf73d88bf5ab2da154ac2f537aa28a67c5f8b6.tar.xz
mpd-4dbf73d88bf5ab2da154ac2f537aa28a67c5f8b6.zip
output: protect audio_output.open with the mutex
There was a deadlock between the output thread and the player thread: when the output thread failed (and closed itself) while the player thread worked with the audio_output object, MPD could crash.
Diffstat (limited to 'src/output_internal.h')
-rw-r--r--src/output_internal.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/output_internal.h b/src/output_internal.h
index 3ec0485b2..9fc2425c2 100644
--- a/src/output_internal.h
+++ b/src/output_internal.h
@@ -65,6 +65,11 @@ struct audio_output {
/**
* Is the device (already) open and functional?
+ *
+ * This attribute may only be modified by the output thread.
+ * It is protected with #mutex: write accesses inside the
+ * output thread and read accesses outside of it may only be
+ * performed while the lock is held.
*/
bool open;
@@ -113,7 +118,7 @@ struct audio_output {
const struct music_pipe *pipe;
/**
- * This mutex protects #chunk and #chunk_finished.
+ * This mutex protects #open, #chunk and #chunk_finished.
*/
GMutex *mutex;