DWORD SleepEx(dwTimeout, fAlertable) | |||||
DWORD dwTimeout; | /* timeout time in milliseconds | */ | |||
BOOL fAlertable; | /* return if I/O completes? | */ |
The SleepEx function causes the current thread to enter a waiting state until the specified interval of time has passed, or until an I/O completion callback function is called.
This function is available only in Win32/NT.
dwTimeout
Specifies the relative time, in milliseconds, that the delay is to occur. A value of 0 specifies that the function will return immediately. A value of INFINITE specifies an infinite delay.
fAlertable
Specifies whether the function may terminate early due to an I/O completion callback. If fAlertable is TRUE and the thread that called this function is the same thread that called the extended I/O function, then the wait can return due to any one of the wait termination conditions or because an I/O completion callback terminated the wait early (in this case, the return value is WAIT_IO_COMPLETION).
If fAlertable is FALSE, the function will not return when an I/O completion callback occurs.
The return value is zero if the specified time interval expired.
The return value is WAIT_IO_COMPLETION if the function terminated due to one or more I/O completion callbacks, fAlertable is TRUE, and the thread that called the SleepEx function is the same thread that called the extended I/O function.
If fAlertable is FALSE, this function will not return until the specified time interval has passed. If fAlertable is TRUE, the function may return when the time interval expires (the return value is zero), or when an I/O completion callback occurs (the return value is WAIT_IO_COMPLETION).
This function can be used with the ReadFileEx or WriteFileEx functions to suspend a thread until an I/O operation completes.
ReadFileEx, Sleep WaitForMultipleObjectsEx, WaitForSingleObjectEx, WriteFileEx