File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class Signal
137137 Signal () {}
138138
139139 // http://en.cppreference.com/w/cpp/thread/condition_variable
140- void Trigger ()
140+ void Trigger (bool bNotifyAll = false )
141141 {
142142 // The thread that intends to modify the variable has to
143143 // * acquire a std::mutex (typically via std::lock_guard)
@@ -150,7 +150,10 @@ class Signal
150150 }
151151 // Unlocking is done before notifying, to avoid waking up the waiting
152152 // thread only to block again (see notify_one for details)
153- m_CondVar.notify_one ();
153+ if (bNotifyAll)
154+ m_CondVar.notify_all ();
155+ else
156+ m_CondVar.notify_one ();
154157 }
155158
156159 void Wait ()
@@ -182,7 +185,7 @@ class Signal
182185 std::mutex m_Mutex;
183186 std::condition_variable m_CondVar;
184187 volatile bool m_bIsTriggered = false ;
185-
188+
186189 Signal (const Signal&) = delete ;
187190 Signal& operator = (const Signal&) = delete ;
188191};
You can’t perform that action at this time.
0 commit comments