From 3143dbf3dc2639593f5266e400562b7c4c3d30f2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Sep 2016 16:11:51 +0200 Subject: [PATCH] input/Open: use ScopeLock --- src/input/Open.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/input/Open.cxx b/src/input/Open.cxx index cb4b932f3..9d52541bb 100644 --- a/src/input/Open.cxx +++ b/src/input/Open.cxx @@ -67,10 +67,13 @@ InputStream::OpenReady(const char *uri, if (is == nullptr) return nullptr; - mutex.lock(); - is->WaitReady(); - bool success = is->Check(error); - mutex.unlock(); + bool success; + + { + const ScopeLock protect(mutex); + is->WaitReady(); + success = is->Check(error); + } if (!success) is.reset();