Kernel32WaitForSingleObject Method

Waits until the specified object is in the signaled state or the time-out interval elapses.

To enter an alertable wait state, use the WaitForSingleObjectEx(IntPtr, UInt32, Boolean) function.

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 WaitForSingleObject(
	IntPtr handle,
	uint milliseconds
)

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 or the interval elapses.

If dwMilliseconds is zero, the function does not enter a wait state if the object is not signaled; it always returns immediately.

If milliseconds is INFINITE (0xFFFFFFFF), the function will return only when the object is signaled.

Return Value

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

Remarks

See Also