diff --git a/src/pevents.cpp b/src/pevents.cpp index 70c1457..ae2ab94 100644 --- a/src/pevents.cpp +++ b/src/pevents.cpp @@ -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); }