Skip to content

Commit

Permalink
fixup! Make WaitForMultipleEvents atomic when waitAll is true
Browse files Browse the repository at this point in the history
  • Loading branch information
mqudsi committed Jul 8, 2021
1 parent 2db23ff commit 1daad02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@ namespace neosmart {
consumed = true;
}

// Explictly set `StillWaiting` to false ourselves rather than waiting for the
// waiter to do it so another `SetEvent()` on a different autoreset event also
// being awaited by the same waiter isn't also consumed if scheduled before the
// waiter gets around to setting StillWaiting to false.
i->Waiter->StillWaiting = false;

result = pthread_cond_signal(&i->Waiter->CVariable);
assert(result == 0);
}
Expand Down

0 comments on commit 1daad02

Please sign in to comment.