player/Control: use class ScopeLock

This commit is contained in:
Max Kellermann
2015-11-11 17:41:48 +01:00
parent afc1236b06
commit c6d1d360a3
2 changed files with 19 additions and 36 deletions

View File

@@ -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();