net: fMsgProcWake use LOCK instead of lock_guard

This commit is contained in:
Anthony Towns committed 2020-05-19 16:33:10 +10:00
1 parent de7c5f41ab
commit 8b5af3d4c1
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -1454,7 +1454,7 @@ void CConnman::ThreadSocketHandler()
void CConnman::WakeMessageHandler() void CConnman::WakeMessageHandler()
{ {
{ {
std::lock_guard<std::mutex> lock(mutexMsgProc); LOCK(mutexMsgProc);
fMsgProcWake = true; fMsgProcWake = true;
} }
condMsgProc.notify_one(); condMsgProc.notify_one();
@@ -2057,7 +2057,7 @@ void CConnman::ThreadMessageHandler()
WAIT_LOCK(mutexMsgProc, lock); WAIT_LOCK(mutexMsgProc, lock);
if (!fMoreWork) { 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; fMsgProcWake = false;
} }
@@ -2366,7 +2366,7 @@ static CNetCleanup instance_of_cnetcleanup;
void CConnman::Interrupt() void CConnman::Interrupt()
{ {
{ {
std::lock_guard<std::mutex> lock(mutexMsgProc); LOCK(mutexMsgProc);
flagInterruptMsgProc = true; flagInterruptMsgProc = true;
} }
condMsgProc.notify_all(); condMsgProc.notify_all();
+1 -1
View File
@@ -451,7 +451,7 @@ private:
const uint64_t nSeed0, nSeed1; const uint64_t nSeed0, nSeed1;
/** flag for waking the message processor. */ /** flag for waking the message processor. */
bool fMsgProcWake; bool fMsgProcWake GUARDED_BY(mutexMsgProc);
std::condition_variable condMsgProc; std::condition_variable condMsgProc;
Mutex mutexMsgProc; Mutex mutexMsgProc;