Kernel32WaitForSingleObjectEx Method

Waits until the specified object is in the signaled state, an I/O completion routine or asynchronous procedure call (APC) is queued to the thread, or the time-out interval elapses.

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("Kernel32.dll", SetLastError = true)]
public static WaitObjectResult WaitForSingleObjectEx(
	IntPtr handle,
	uint milliseconds,
	bool alertable
)

Parameters

handle  IntPtr
A handle to the object.

If this handle is closed while the wait is still pending, the function's behavior is undefined.

The handle must have the SYNCHRONIZE access right.

milliseconds  UInt32
The time-out interval, in milliseconds.

If a nonzero value is specified, the function waits until the object is signaled, an I/O completion routine or APC is queued, or the interval elapses.

If milliseconds is zero, the function does not enter a wait state if the criteria is not met; it always returns immediately.

If milliseconds is INFINITE (0xFFFFFFFF), the function will return only when the object is signaled or an I/O completion routine or APC is queued

alertable  Boolean
If this parameter is and the thread is in the waiting state, the function returns when the system queues an I/O completion routine or APC, and the thread runs the routine or function.

Otherwise, the function does not return, and the completion routine or APC function is not executed.

A completion routine is queued when the ReadFileEx or WriteFileEx function in which it was specified has completed.

The wait function returns and the completion routine is called only if bAlertable is , and the calling thread is the thread that initiated the read or write operation. An APC is queued when you call QueueUserAPC.

Return Value

WaitObjectResult
If the function succeeds, the return value indicates the event that caused the function to return.

Remarks

See Also