aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderControl.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-28 10:09:04 +0100
committerMax Kellermann <max@duempel.org>2013-10-28 10:22:05 +0100
commit1ad2475f9e3c88b992f3fd3d6a77842287d3e4db (patch)
treeb9d16a4bfeb2fa54f1bfe002df3da44341929709 /src/DecoderControl.cxx
parent5b5675cc121eff6ba4b89719a523bfbe3993ce2f (diff)
downloadmpd-1ad2475f9e3c88b992f3fd3d6a77842287d3e4db.tar.gz
mpd-1ad2475f9e3c88b992f3fd3d6a77842287d3e4db.tar.xz
mpd-1ad2475f9e3c88b992f3fd3d6a77842287d3e4db.zip
DecoderControl: convert mutex and client_cond to a reference
Share the Mutex between the DecoderThread and the PlayerThread. This simplifies synchronization between the two threads and fixes a freeze problem: while the PlayerThread waits for the DeocderThread, it cannot answer requests from the main thread, and the main thread will block until the DecoderThread finishes.
Diffstat (limited to 'src/DecoderControl.cxx')
-rw-r--r--src/DecoderControl.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/DecoderControl.cxx b/src/DecoderControl.cxx
index 299acac8c..d76580cbb 100644
--- a/src/DecoderControl.cxx
+++ b/src/DecoderControl.cxx
@@ -26,8 +26,9 @@
#include <assert.h>
-DecoderControl::DecoderControl()
- :state(DecoderState::STOP),
+DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond)
+ :mutex(_mutex), client_cond(_client_cond),
+ state(DecoderState::STOP),
command(DecoderCommand::NONE),
song(nullptr),
replay_gain_db(0), replay_gain_prev_db(0) {}