Kernel32SleepEx Method

Suspends the current thread until the specified condition is met. Execution resumes when one of the following occurs:

- An I/O completion callback function is called.

- An asynchronous procedure call (APC) is queued to the thread.

- 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 uint SleepEx(
	int milliseconds,
	bool alertable
)

Parameters

milliseconds  Int32
The time interval for which execution is to be suspended, in milliseconds.

A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run.

If there are no other threads ready to run, the function returns immediately, and the thread continues execution.

A value of INFINITE (-1) indicates that the suspension should not time out.

alertable  Boolean
If this parameter is , the function does not return until the time-out period has elapsed. If an I/O completion callback occurs, the function does not return and the I/O completion function is not executed. If an APC is queued to the thread, the function does not return and the APC function is not executed.

If the parameter is and the thread that called this function is the same thread that called the extended I/O function (ReadFileEx or WriteFileEx), the function returns when either the time-out period has elapsed or when an I/O completion callback function occurs. If an I/O completion callback occurs, the I/O completion function is called. If an APC is queued to the thread (QueueUserAPC), the function returns when either the timer-out period has elapsed or when the APC function is called.

Return Value

UInt32

[Missing <returns> documentation for "M:DevCase.Win32.NativeMethods.Kernel32.SleepEx(System.Int32,System.Boolean)"]

Remarks

See Also