From 362aaacad7176f557e83e880e53c8623080ca778 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 7 Jan 2018 13:06:42 -0800 Subject: Updated Signal class to allow notify_all() --- Common/interface/LockHelper.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Common/interface') diff --git a/Common/interface/LockHelper.h b/Common/interface/LockHelper.h index 1dfe44db..4cd3e337 100644 --- a/Common/interface/LockHelper.h +++ b/Common/interface/LockHelper.h @@ -137,7 +137,7 @@ public: Signal() {} // http://en.cppreference.com/w/cpp/thread/condition_variable - void Trigger() + void Trigger(bool bNotifyAll = false) { // The thread that intends to modify the variable has to // * acquire a std::mutex (typically via std::lock_guard) @@ -150,7 +150,10 @@ public: } // Unlocking is done before notifying, to avoid waking up the waiting // thread only to block again (see notify_one for details) - m_CondVar.notify_one(); + if(bNotifyAll) + m_CondVar.notify_all(); + else + m_CondVar.notify_one(); } void Wait() @@ -182,7 +185,7 @@ private: std::mutex m_Mutex; std::condition_variable m_CondVar; volatile bool m_bIsTriggered = false; - + Signal(const Signal&) = delete; Signal& operator = (const Signal&) = delete; }; -- cgit v1.2.3