From d38a079ba1bec387c8a6eaa34d88df53380b2c49 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Thu, 25 Apr 2019 19:23:52 +0200
Subject: [PATCH] neighbor/smbclient: use std::lock_guard

---
 src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
index be944b0ec..71e94266a 100644
--- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
@@ -94,10 +94,11 @@ SmbclientNeighborExplorer::Open()
 void
 SmbclientNeighborExplorer::Close() noexcept
 {
-	mutex.lock();
-	quit = true;
-	cond.signal();
-	mutex.unlock();
+	{
+		const std::lock_guard<Mutex> lock(mutex);
+		quit = true;
+		cond.signal();
+	}
 
 	thread.Join();
 }
@@ -237,7 +238,7 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
 {
 	SetThreadName("smbclient");
 
-	mutex.lock();
+	const std::lock_guard<Mutex> lock(mutex);
 
 	while (!quit) {
 		Run();
@@ -248,8 +249,6 @@ SmbclientNeighborExplorer::ThreadFunc() noexcept
 		// TODO: sleep for how long?
 		cond.timed_wait(mutex, std::chrono::seconds(10));
 	}
-
-	mutex.unlock();
 }
 
 static std::unique_ptr<NeighborExplorer>