WaitForSingleObject
The WaitForSingleObject function returns when one of the following occurs:
The specified object is in the signaled state.
The time-out interval elapses.
To enter an alertable wait state, use the WaitForSingleObjectEx function. To wait for multiple objects, use the WaitForMultipleObjects.