aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-04 23:40:43 +0100
committerMax Kellermann <max@duempel.org>2010-11-04 23:40:43 +0100
commit2ee047a1ddf2bb4d7e25a259492952c6128a749d (patch)
treece0abe021b3e2a26d394188c3bccfb42a95bbda2
parent9562f667412dc620bed7299477c8a5bd86e399c4 (diff)
downloadmpd-2ee047a1ddf2bb4d7e25a259492952c6128a749d.tar.gz
mpd-2ee047a1ddf2bb4d7e25a259492952c6128a749d.tar.xz
mpd-2ee047a1ddf2bb4d7e25a259492952c6128a749d.zip
output_internal: protect attribute "fail_timer" with mutex
Diffstat (limited to '')
-rw-r--r--src/output_internal.h3
-rw-r--r--src/output_thread.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/output_internal.h b/src/output_internal.h
index 72596c1c3..b863c9ecc 100644
--- a/src/output_internal.h
+++ b/src/output_internal.h
@@ -131,7 +131,8 @@ struct audio_output {
const struct music_pipe *pipe;
/**
- * This mutex protects #open, #chunk and #chunk_finished.
+ * This mutex protects #open, #fail_timer, #chunk and
+ * #chunk_finished.
*/
GMutex *mutex;
diff --git a/src/output_thread.c b/src/output_thread.c
index e652eae57..b97694169 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -105,7 +105,12 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
/* don't automatically reopen this device for
10 seconds */
+ g_mutex_lock(ao->mutex);
+
+ assert(ao->fail_timer == NULL);
ao->fail_timer = g_timer_new();
+
+ g_mutex_unlock(ao->mutex);
return false;
}