aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_api.h
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.h
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.h')
-rw-r--r--src/mixer_api.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mixer_api.h b/src/mixer_api.h
index 62c277b9d..9af49cd87 100644
--- a/src/mixer_api.h
+++ b/src/mixer_api.h
@@ -23,8 +23,16 @@
#include "mixer_plugin.h"
#include "mixer_list.h"
+#include <glib.h>
+
struct mixer {
const struct mixer_plugin *plugin;
+
+ /**
+ * This mutex protects all of the mixer struct, including its
+ * implementation, so plugins don't have to deal with that.
+ */
+ GMutex *mutex;
};
void