thread/Mutex: remove ScopeLock, use std::lock_guard directly

This commit is contained in:
Max Kellermann
2017-01-03 07:11:57 +01:00
parent a42021655c
commit 2e182e84c3
51 changed files with 158 additions and 160 deletions

View File

@@ -64,7 +64,7 @@ PlayerControl::Play(DetachedSong *song)
{
assert(song != nullptr);
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
SeekLocked(song, SongTime::zero());
if (state == PlayerState::PAUSE)
@@ -118,14 +118,14 @@ PlayerControl::PauseLocked()
void
PlayerControl::LockPause()
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
PauseLocked();
}
void
PlayerControl::LockSetPause(bool pause_flag)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
switch (state) {
case PlayerState::STOP:
@@ -146,7 +146,7 @@ PlayerControl::LockSetPause(bool pause_flag)
void
PlayerControl::LockSetBorderPause(bool _border_pause)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
border_pause = _border_pause;
}
@@ -155,7 +155,7 @@ PlayerControl::LockGetStatus()
{
player_status status;
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
SynchronousCommand(PlayerCommand::REFRESH);
status.state = state;
@@ -183,14 +183,14 @@ PlayerControl::SetError(PlayerError type, std::exception_ptr &&_error)
void
PlayerControl::LockClearError()
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
ClearError();
}
void
PlayerControl::LockSetTaggedSong(const DetachedSong &song)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
delete tagged_song;
tagged_song = new DetachedSong(song);
}
@@ -207,7 +207,7 @@ PlayerControl::LockEnqueueSong(DetachedSong *song)
{
assert(song != nullptr);
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
EnqueueSongLocked(song);
}
@@ -246,7 +246,7 @@ PlayerControl::LockSeek(DetachedSong *song, SongTime t)
assert(song != nullptr);
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
SeekLocked(song, t);
}