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.
This commit is contained in:
Max Kellermann
2013-10-28 10:09:04 +01:00
parent 5b5675cc12
commit 1ad2475f9e
4 changed files with 30 additions and 24 deletions

View File

@@ -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) {}