From 9ace6f969ce495185df34cc6254fb9d297765478 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 21 Apr 2024 19:33:47 +0100 Subject: [PATCH] core: use a lock_guard for loopRequestMutex fixes #207 --- src/core/PortalManager.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/PortalManager.cpp b/src/core/PortalManager.cpp index 84dd910..5420c98 100644 --- a/src/core/PortalManager.cpp +++ b/src/core/PortalManager.cpp @@ -420,13 +420,11 @@ void CPortalManager::startEventLoop() { while (1) { // dbus events // wait for being awakened - m_sEventLoopInternals.loopRequestMutex.unlock(); // unlock, we are ready to take events - std::unique_lock lk(m_sEventLoopInternals.loopMutex); if (m_sEventLoopInternals.shouldProcess == false) // avoid a lock if a thread managed to request something already since we .unlock()ed m_sEventLoopInternals.loopSignal.wait(lk, [this] { return m_sEventLoopInternals.shouldProcess == true; }); // wait for events - m_sEventLoopInternals.loopRequestMutex.lock(); // lock incoming events + std::lock_guard lg(m_sEventLoopInternals.loopRequestMutex); if (m_bTerminate) break;