| 73 | |
| 74 | #if defined(_TTHREAD_WIN32_) |
| 75 | void condition_variable::_wait() |
| 76 | { |
| 77 | // Wait for either event to become signaled due to notify_one() or |
| 78 | // notify_all() being called |
| 79 | int result = WaitForMultipleObjects(2, mEvents, FALSE, INFINITE); |
| 80 | |
| 81 | // Check if we are the last waiter |
| 82 | EnterCriticalSection(&mWaitersCountLock); |
| 83 | -- mWaitersCount; |
| 84 | bool lastWaiter = (result == (WAIT_OBJECT_0 + _CONDITION_EVENT_ALL)) && |
| 85 | (mWaitersCount == 0); |
| 86 | LeaveCriticalSection(&mWaitersCountLock); |
| 87 | |
| 88 | // If we are the last waiter to be notified to stop waiting, reset the event |
| 89 | if(lastWaiter) |
| 90 | ResetEvent(mEvents[_CONDITION_EVENT_ALL]); |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | #if defined(_TTHREAD_WIN32_) |
nothing calls this directly
no outgoing calls
no test coverage detected