diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-01-07 21:06:42 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-01-07 21:06:42 +0000 |
| commit | 362aaacad7176f557e83e880e53c8623080ca778 (patch) | |
| tree | d07eedca8a3a2f953f1a9437f63c9792c01f540e /Common/interface | |
| parent | Added MatrixFromRows() function to shader definitions (diff) | |
| download | DiligentCore-362aaacad7176f557e83e880e53c8623080ca778.tar.gz DiligentCore-362aaacad7176f557e83e880e53c8623080ca778.zip | |
Updated Signal class to allow notify_all()
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/LockHelper.h | 9 |
1 files changed, 6 insertions, 3 deletions
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; }; |
