aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2019-05-30 13:44:02 +1000
committerAnthony Towns <aj@erisian.com.au>2020-05-19 16:33:10 +1000
commit8b5af3d4c1270267ad85e78f661bf8fab06f3aad (patch)
treefb51d32074cfe24c9f92bfc6bf7c21069cbeda10
parentde7c5f41aba860751ef7824245e6d9d5088a1200 (diff)
net: fMsgProcWake use LOCK instead of lock_guard
-rw-r--r--src/net.cpp6
-rw-r--r--src/net.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp
index dcc613ba88..4e80e123d1 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1454,7 +1454,7 @@ void CConnman::ThreadSocketHandler()
void CConnman::WakeMessageHandler()
{
{
- std::lock_guard<std::mutex> lock(mutexMsgProc);
+ LOCK(mutexMsgProc);
fMsgProcWake = true;
}
condMsgProc.notify_one();
@@ -2057,7 +2057,7 @@ void CConnman::ThreadMessageHandler()
WAIT_LOCK(mutexMsgProc, lock);
if (!fMoreWork) {
- condMsgProc.wait_until(lock, std::chrono::steady_clock::now() + std::chrono::milliseconds(100), [this] { return fMsgProcWake; });
+ condMsgProc.wait_until(lock, std::chrono::steady_clock::now() + std::chrono::milliseconds(100), [this]() EXCLUSIVE_LOCKS_REQUIRED(mutexMsgProc) { return fMsgProcWake; });
}
fMsgProcWake = false;
}
@@ -2366,7 +2366,7 @@ static CNetCleanup instance_of_cnetcleanup;
void CConnman::Interrupt()
{
{
- std::lock_guard<std::mutex> lock(mutexMsgProc);
+ LOCK(mutexMsgProc);
flagInterruptMsgProc = true;
}
condMsgProc.notify_all();
diff --git a/src/net.h b/src/net.h
index 0d79efbba7..a4bf06e47f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -451,7 +451,7 @@ private:
const uint64_t nSeed0, nSeed1;
/** flag for waking the message processor. */
- bool fMsgProcWake;
+ bool fMsgProcWake GUARDED_BY(mutexMsgProc);
std::condition_variable condMsgProc;
Mutex mutexMsgProc;