diff options
author | Max Kellermann <max@duempel.org> | 2009-03-14 11:53:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-14 11:53:28 +0100 |
commit | 7deade857733e2a38d2da926acfc69b235fa4d0f (patch) | |
tree | 623e432726c254954035351566ce202a209d41c8 /src/mixer_api.c | |
parent | 82963ee0238ec9977161b27183294d39a817336f (diff) | |
download | mpd-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.c | 3 |
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(); } |