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

@@ -88,7 +88,7 @@ need_chunks(DecoderControl &dc)
static DecoderCommand
LockNeedChunks(DecoderControl &dc)
{
const ScopeLock protect(dc.mutex);
const std::lock_guard<Mutex> protect(dc.mutex);
return need_chunks(dc);
}
@@ -130,7 +130,7 @@ DecoderBridge::FlushChunk()
else
dc.pipe->Push(chunk);
const ScopeLock protect(dc.mutex);
const std::lock_guard<Mutex> protect(dc.mutex);
if (dc.client_is_waiting)
dc.client_cond.signal();
}
@@ -193,7 +193,7 @@ DecoderBridge::GetVirtualCommand()
DecoderCommand
DecoderBridge::LockGetVirtualCommand()
{
const ScopeLock protect(dc.mutex);
const std::lock_guard<Mutex> protect(dc.mutex);
return GetVirtualCommand();
}
@@ -258,7 +258,7 @@ DecoderBridge::Ready(const AudioFormat audio_format,
seekable ? "true" : "false");
{
const ScopeLock protect(dc.mutex);
const std::lock_guard<Mutex> protect(dc.mutex);
dc.SetReady(audio_format, seekable, duration);
}
@@ -287,7 +287,7 @@ DecoderBridge::GetCommand()
void
DecoderBridge::CommandFinished()
{
const ScopeLock protect(dc.mutex);
const std::lock_guard<Mutex> protect(dc.mutex);
assert(dc.command != DecoderCommand::NONE || initial_seek_running);
assert(dc.command != DecoderCommand::SEEK ||
@@ -376,7 +376,7 @@ DecoderBridge::OpenUri(const char *uri)
auto is = InputStream::Open(uri, mutex, cond);
const ScopeLock lock(mutex);
const std::lock_guard<Mutex> lock(mutex);
while (true) {
is->Update();
if (is->IsReady())
@@ -399,7 +399,7 @@ try {
if (length == 0)
return 0;
ScopeLock lock(is.mutex);
std::lock_guard<Mutex> lock(is.mutex);
while (true) {
if (CheckCancelRead())