File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ class Scheduler {
122122
123123 // Notify waiters only when work transitions to "done".
124124 if (activeTasks_.fetch_sub (1 , std::memory_order_release) == 1 ) {
125+ std::lock_guard<std::mutex> lock (waitMutex_);
125126 condition_.notify_all ();
126127 }
127128 }
@@ -183,7 +184,10 @@ class Scheduler {
183184
184185 queuedTasks_.fetch_add (1 , std::memory_order_release);
185186 activeTasks_.fetch_add (1 , std::memory_order_release);
186- condition_.notify_one ();
187+ {
188+ std::lock_guard<std::mutex> lock (waitMutex_);
189+ condition_.notify_one ();
190+ }
187191 return true ;
188192 }
189193
@@ -201,6 +205,7 @@ class Scheduler {
201205 } catch (...) { /* ignore */
202206 }
203207 if (activeTasks_.fetch_sub (1 , std::memory_order_release) == 1 ) {
208+ std::lock_guard<std::mutex> lock (waitMutex_);
204209 condition_.notify_all ();
205210 }
206211 }
You can’t perform that action at this time.
0 commit comments