You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Raymond Chen edited this page Apr 13, 2021
·
3 revisions
Waiting on a single kernel object
The handle_wait function is a wrapper around the WaitForSingleObject function.
It waits on an arbitrary waitable kernel object with an optional timeout.
It returns true if the wait was successful or false if the wait timed out.
It fails fast for any other condition, such as an invalid handle or an abandoned mutex.
Individual synchronization objects typically expose methods for waiting.
To wait on an event, use the unique_event.wait() method.
To wait on a mutex and automatically release the mutex at scope exit, use the unique_mutex.acquire method.
To wait on a semaphore and automatically release a token at scope exit, use the unique_semaphore.acquire method.
Waiting on multiple objects
The unique_handle classes (which includes unique_event, unique_mutex, and
unique_semaphore) are the same size as a kernel handle.
This permits you to call WaitForMultipleObjects and MsgWaitForMultipleObjects
with conformant arrays of those objects: