Sleep

From aldeid
Jump to: navigation, search

Description

Suspends the execution of the current thread until the time-out interval elapses.

To enter an alertable wait state, use the SleepEx function.

Syntax

VOID WINAPI Sleep(
  _In_  DWORD dwMilliseconds
);

Parameters

dwMilliseconds [in]
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.
Windows XP: A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. This behavior changed starting with Windows Server 2003.
A value of INFINITE indicates that the suspension should not time out.

Return value

This function does not return a value.

Example

.text:0040113B                 push    0FFFFFFFFh      ; dwMilliseconds
.text:0040113D                 call    ds:Sleep