Waits for specified handles to be signaled or for a specified timeout period to elapse.
HRESULT CoWaitForMultipleHandles( DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex );
The wait options. Possible values are taken from the COWAIT_FLAGS enumeration.
The timeout period, in milliseconds.
The number of elements in the pHandles array.
An array of handles.
A pointer to a variable that, when the returned status is S_OK, receives a value indicating the event that caused the function to return. This value is usually the index into pHandles for the handle that was signaled.
If pHandles includes one or more handles to mutex objects, a value between WAIT_ABANDONED_0 and (WAIT_ABANDONED_0 + nCount - 1) indicates the index into pHandles for the mutex that was abandoned.
If the COWAIT_ALERTABLE flag is set in dwFlags, a value of WAIT_IO_COMPLETION indicates the wait was ended by one or more user-mode asynchronous procedure calls (APC) queued to the thread.
See WaitForMultipleObjectsEx for more information.
This function can return the following values.
||The required handle or handles were signaled.|
||pHandles was NULL, lpdwindex was NULL, or dwFlags was not a value from the COWAIT_FLAGS enumeration.|
||The value of pHandles was 0.|
||The timeout period elapsed before the required handle or handles were signaled.|
Depending on which flags are set in the dwFlags parameter, CoWaitForMultipleHandles blocks the calling thread until one of the following events occurs:
- One or all of the handles is signaled. In the case of mutex objects, this condition is also satisfied by a mutex being abandoned.
- An asynchronous procedure call (APC) has been queued to the calling thread with a call to the QueueUserAPC function.
- The timeout period expires.
If the calling thread resides in a multithread apartment (MTA), CoWaitForMultipleHandles calls the WaitForMultipleObjectsEx function.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||combaseapi.h (include Objbase.h)|