Ole32CoWaitForMultipleHandles Method

Waits for specified handles to be signaled or for a specified timeout period to elapse.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Ole32.dll", SetLastError = true)]
public static HResult CoWaitForMultipleHandles(
	CoWaitForMultipleHandlesFlags flags,
	uint signalTimeout,
	uint handleCount,
	IntPtr[] handles,
	ref uint refHandleIndex
)

Parameters

flags  CoWaitForMultipleHandlesFlags
The handle wait options.
signalTimeout  UInt32
The timeout period, in milliseconds.
handleCount  UInt32
The number of elements in the pHandles array.
handles  IntPtr
An array of handles.
refHandleIndex  UInt32
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 handles for the handle that was signaled.

If handles includes one or more handles to mutex objects, a value between WAIT_ABANDONED_0 and (WAIT_ABANDONED_0 + nCount 1) indicates the index into handles for the mutex that was abandoned.

If the Alertable flag is set in flags, 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.

Return Value

HResult
Returns S_OK on success, or other HResult if an error occurs.

Note that the return value of CoWaitForMultipleHandles(CoWaitForMultipleHandlesFlags, UInt32, UInt32, IntPtr, UInt32) can be nondeterministic if the Alertable flag is set in flags, or if handles includes one or more handles to mutex objects.

The recommended workaround is to call SetLastError(ERROR_SUCCESS) before CoWaitForMultipleHandles(CoWaitForMultipleHandlesFlags, UInt32, UInt32, IntPtr, UInt32).

Remarks

Example

This is a code example.
C#
No code example is currently available or this language may not be supported.

See Also