MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / _wait

Method _wait

src/tinythread/tinythread.cpp:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74#if defined(_TTHREAD_WIN32_)
75void 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_)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected