CoWaitForMultipleHandles function (combaseapi.h)
Waits for specified handles to be signaled or for a specified timeout period to elapse.
Syntax
HRESULT CoWaitForMultipleHandles(
[in] DWORD dwFlags,
[in] DWORD dwTimeout,
[in] ULONG cHandles,
[in] LPHANDLE pHandles,
[out] LPDWORD lpdwindex
);
Parameters
[in] dwFlags
The wait options. Possible values are taken from the COWAIT_FLAGS enumeration.
[in] dwTimeout
The timeout period, in milliseconds.
[in] cHandles
The number of elements in the pHandles array.
[in] pHandles
An array of handles.
[out] lpdwindex
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.
Return value
This function can return the following values.
Return code | Description |
---|---|
|
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. |
Remarks
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.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | combaseapi.h (include Objbase.h) |
Library | Ole32.lib |
DLL | Ole32.dll |