WaitForMultipleObjectsThe WaitForMultipleObjects function returns when one of the following occurs: Either any one or all of the specified objects are in the signaled state. The time-out interval elapses.
To enter an alertable wait state, use the WaitForMultipleObjectsEx function. DWORD WaitForMultipleObjects( DWORD nCount, // number of handles in array CONST HANDLE *lpHandles, // object-handle array BOOL bWaitAll, // wait option DWORD dwMilliseconds // time-out interval);