aboutsummaryrefslogtreecommitdiffstats
path: root/src/player/Control.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-11 17:41:48 +0100
committerMax Kellermann <max@duempel.org>2015-11-11 17:43:56 +0100
commitc6d1d360a3b7034c661bb348fda732177192390f (patch)
tree3866095e64f74a438a3fd7877e1f0105db312676 /src/player/Control.hxx
parentafc1236b066480656cd7285364a9d79dae01f763 (diff)
downloadmpd-c6d1d360a3b7034c661bb348fda732177192390f.tar.gz
mpd-c6d1d360a3b7034c661bb348fda732177192390f.tar.xz
mpd-c6d1d360a3b7034c661bb348fda732177192390f.zip
player/Control: use class ScopeLock
Diffstat (limited to '')
-rw-r--r--src/player/Control.hxx21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/player/Control.hxx b/src/player/Control.hxx
index edfde09fe..df2dc35be 100644
--- a/src/player/Control.hxx
+++ b/src/player/Control.hxx
@@ -210,9 +210,8 @@ struct PlayerControl {
* this function.
*/
void LockSignal() {
- Lock();
+ const ScopeLock protect(mutex);
Signal();
- Unlock();
}
/**
@@ -264,9 +263,8 @@ struct PlayerControl {
}
void LockCommandFinished() {
- Lock();
+ const ScopeLock protect(mutex);
CommandFinished();
- Unlock();
}
private:
@@ -304,9 +302,8 @@ private:
* object.
*/
void LockSynchronousCommand(PlayerCommand cmd) {
- Lock();
+ const ScopeLock protect(mutex);
SynchronousCommand(cmd);
- Unlock();
}
public:
@@ -377,10 +374,8 @@ public:
*/
gcc_pure
Error LockGetError() const {
- Lock();
- Error result = GetError();
- Unlock();
- return result;
+ const ScopeLock protect(mutex);
+ return GetError();
}
void LockClearError();
@@ -412,10 +407,8 @@ public:
* Like ReadTaggedSong(), but locks and unlocks the object.
*/
DetachedSong *LockReadTaggedSong() {
- Lock();
- DetachedSong *result = ReadTaggedSong();
- Unlock();
- return result;
+ const ScopeLock protect(mutex);
+ return ReadTaggedSong();
}
void LockStop();