Skip to content

Commit

Permalink
Yield thread when notifying condition variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusTomlinson committed Mar 21, 2024
1 parent f936362 commit 8de542a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/dspatch/Circuit.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class Circuit final
{
_pause = false;
_resumeCondt.notify_all();
std::this_thread::yield();
}
}

Expand Down Expand Up @@ -253,6 +254,7 @@ class Circuit final
{
_gotSync = false; // reset the sync flag
_resumeCondt.notify_all();
std::this_thread::yield();
}

inline void SyncAndResume()
Expand Down Expand Up @@ -372,6 +374,7 @@ class Circuit final
{
_gotSync = false; // reset the sync flag
_resumeCondt.notify_all();
std::this_thread::yield();
}

private:
Expand Down

0 comments on commit 8de542a

Please sign in to comment.