replace lock with lock_guard
Change-Id: I778fd472546a0287f068f04569a67315045ee901
diff --git a/src/chat-dialog-backend.cpp b/src/chat-dialog-backend.cpp
index 801db7d..216f465 100644
--- a/src/chat-dialog-backend.cpp
+++ b/src/chat-dialog-backend.cpp
@@ -65,10 +65,11 @@
m_face->getIoService().run();
- m_mutex.lock();
- shouldResume = m_shouldResume;
- m_shouldResume = false;
- m_mutex.unlock();
+ {
+ std::lock_guard<std::mutex>lock(m_mutex);
+ shouldResume = m_shouldResume;
+ m_shouldResume = false;
+ }
} while (shouldResume);
@@ -486,9 +487,10 @@
// Update localPrefix
m_localRoutingPrefix = newLocalRoutingPrefix;
- m_mutex.lock();
- m_shouldResume = true;
- m_mutex.unlock();
+ {
+ std::lock_guard<std::mutex>lock(m_mutex);
+ m_shouldResume = true;
+ }
close();
@@ -501,9 +503,10 @@
void
ChatDialogBackend::shutdown()
{
- m_mutex.lock();
- m_shouldResume = false;
- m_mutex.unlock();
+ {
+ std::lock_guard<std::mutex>lock(m_mutex);
+ m_shouldResume = false;
+ }
close();