aboutsummaryrefslogtreecommitdiff
path: root/src/DecoderControl.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-27 17:20:50 +0100
committerMax Kellermann <max@duempel.org>2013-01-27 18:39:32 +0100
commit6f3d70b5e24cebbd6fd8c3a665a801628ef912ff (patch)
tree88ab67b76bac4b88422c3debe7c46d6168a71934 /src/DecoderControl.hxx
parent257a0dee758049586efbf0dc3f0339b0cef03456 (diff)
DecoderControl, InputStream: use Mutex/Cond instead of GMutex/GCond
Diffstat (limited to 'src/DecoderControl.hxx')
-rw-r--r--src/DecoderControl.hxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/DecoderControl.hxx b/src/DecoderControl.hxx
index f7769fa6..c2d7b33a 100644
--- a/src/DecoderControl.hxx
+++ b/src/DecoderControl.hxx
@@ -22,6 +22,8 @@
#include "decoder_command.h"
#include "audio_format.h"
+#include "thread/Mutex.hxx"
+#include "thread/Cond.hxx"
#include <glib.h>
@@ -49,20 +51,20 @@ struct decoder_control {
/**
* This lock protects #state and #command.
*/
- GMutex *mutex;
+ mutable Mutex mutex;
/**
* Trigger this object after you have modified #command. This
* is also used by the decoder thread to notify the caller
* when it has finished a command.
*/
- GCond *cond;
+ Cond cond;
/**
* The trigger of this object's client. It is signalled
* whenever an event occurs.
*/
- GCond *client_cond;
+ Cond client_cond;
enum decoder_state state;
enum decoder_command command;
@@ -137,14 +139,14 @@ struct decoder_control {
* Locks the object.
*/
void Lock() const {
- g_mutex_lock(mutex);
+ mutex.lock();
}
/**
* Unlocks the object.
*/
void Unlock() const {
- g_mutex_unlock(mutex);
+ mutex.unlock();
}
/**
@@ -153,7 +155,7 @@ struct decoder_control {
* calling this function.
*/
void Signal() {
- g_cond_signal(cond);
+ cond.signal();
}
/**
@@ -162,7 +164,7 @@ struct decoder_control {
* prior to calling this function.
*/
void Wait() {
- g_cond_wait(cond, mutex);
+ cond.wait(mutex);
}
/**
@@ -171,7 +173,7 @@ struct decoder_control {
* is only valid in the player thread.
*/
void WaitForDecoder() {
- g_cond_wait(client_cond, mutex);
+ client_cond.wait(mutex);
}
bool IsIdle() const {