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

@@ -192,7 +192,7 @@ AlsaInputStream::PrepareSockets()
void
AlsaInputStream::DispatchSockets()
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
auto w = PrepareWriteBuffer();
const snd_pcm_uframes_t w_frames = w.size / frame_size;

View File

@@ -429,7 +429,7 @@ CurlInputStream::RequestDone(CURLcode result, long status)
FreeEasy();
AsyncInputStream::SetClosed();
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
if (result != CURLE_OK) {
postponed_exception = std::make_exception_ptr(FormatRuntimeError("curl failed: %s",
@@ -693,7 +693,7 @@ CurlInputStream::DataReceived(const void *ptr, size_t received_size)
{
assert(received_size > 0);
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
if (IsSeekPending())
SeekDone();

View File

@@ -142,7 +142,7 @@ NfsInputStream::DoSeek(offset_type new_offset)
void
NfsInputStream::OnNfsFileOpen(uint64_t _size)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
if (reconnecting) {
/* reconnect has succeeded */
@@ -162,7 +162,7 @@ NfsInputStream::OnNfsFileOpen(uint64_t _size)
void
NfsInputStream::OnNfsFileRead(const void *data, size_t data_size)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
assert(!IsBufferFull());
assert(IsBufferFull() == (GetBufferSpace() == 0));
AppendToBuffer(data, data_size);
@@ -175,7 +175,7 @@ NfsInputStream::OnNfsFileRead(const void *data, size_t data_size)
void
NfsInputStream::OnNfsFileError(std::exception_ptr &&e)
{
const ScopeLock protect(mutex);
const std::lock_guard<Mutex> protect(mutex);
if (IsPaused()) {
/* while we're paused, don't report this error to the

View File

@@ -90,7 +90,7 @@ input_smbclient_open(const char *uri,
if (!StringStartsWith(uri, "smb://"))
return nullptr;
const ScopeLock protect(smbclient_mutex);
const std::lock_guard<Mutex> protect(smbclient_mutex);
SMBCCTX *ctx = smbc_new_context();
if (ctx == nullptr)