aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_api.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-14 11:53:28 +0100
committerMax Kellermann <max@duempel.org>2009-03-14 11:53:28 +0100
commit7deade857733e2a38d2da926acfc69b235fa4d0f (patch)
tree623e432726c254954035351566ce202a209d41c8 /src/mixer_api.c
parent82963ee0238ec9977161b27183294d39a817336f (diff)
downloadmpd-7deade857733e2a38d2da926acfc69b235fa4d0f.tar.gz
mpd-7deade857733e2a38d2da926acfc69b235fa4d0f.tar.xz
mpd-7deade857733e2a38d2da926acfc69b235fa4d0f.zip
mixer: protect the mixer struct with a mutex
In some rare cases, there was a race condition between the output thread and the main thread: when you disable/enable an output device in the main thread, this caused a crash in the output thread. Protect the whole mixer struct with a GMutex to prevent that.
Diffstat (limited to 'src/mixer_api.c')
-rw-r--r--src/mixer_api.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mixer_api.c b/src/mixer_api.c
index 1e0aabb10..aaa250d33 100644
--- a/src/mixer_api.c
+++ b/src/mixer_api.c
@@ -19,8 +19,6 @@
#include "mixer_api.h"
-#include <glib.h>
-
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "mixer"
@@ -28,4 +26,5 @@ void
mixer_init(struct mixer *mixer, const struct mixer_plugin *plugin)
{
mixer->plugin = plugin;
+ mixer->mutex = g_mutex_new();
}