diff options
Diffstat (limited to 'src/player/Control.hxx')
-rw-r--r-- | src/player/Control.hxx | 21 |
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(); |