Skip to content

Commit 8de542a

Browse files
Yield thread when notifying condition variables
1 parent f936362 commit 8de542a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/dspatch/Circuit.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class Circuit final
163163
{
164164
_pause = false;
165165
_resumeCondt.notify_all();
166+
std::this_thread::yield();
166167
}
167168
}
168169

@@ -253,6 +254,7 @@ class Circuit final
253254
{
254255
_gotSync = false; // reset the sync flag
255256
_resumeCondt.notify_all();
257+
std::this_thread::yield();
256258
}
257259

258260
inline void SyncAndResume()
@@ -372,6 +374,7 @@ class Circuit final
372374
{
373375
_gotSync = false; // reset the sync flag
374376
_resumeCondt.notify_all();
377+
std::this_thread::yield();
375378
}
376379

377380
private:

0 commit comments

Comments
 (0)