NTSTATUS
KeDelayExecutionThread(
IN KPROCESSOR_MODE WaitMode,
IN BOOLEAN Alertable,
IN PLARGE_INTEGER Interval
);
KeDelayExecutionThread puts the current thread into an alertable or nonalertable wait state for a given interval.
Parameters
WaitMode
Specifies the processor mode in which the caller is waiting, which can be either KernelMode or UserMode. Lower-level drivers should specify KernelMode.
Alertable
Specifies TRUE if the wait is alertable. Lower-level drivers should specify FALSE.
Interval
Specifies the absolute or relative time, in units of 100 nanoseconds, for which the wait is to occur. A negative value indicates relative time. Absolute expiration times track any changes in system time; relative expiration times are not affected by system time changes.
Return Value
The return value of KeDelayExecutionThread identifies how the delay was completed, and can be one of the following:
Value | Meaning |
STATUS_SUCCESS | The delay was completed because the specified interval elapsed. |
STATUS_ALERTED | The delay was completed because the thread was alerted. |
STATUS_USER_APC | A user-mode APC was delivered before the given Interval expired. |
Comments
The expiration time is computed and the current thread is put in a wait state. When the specified interval has passed, the thread exits the wait state and is put in the ready state, becoming eligible for execution.
The Alertable parameter specifies whether the thread can be alerted in the wait state. If the value of this parameter is TRUE and the thread is alerted for a mode that is equal to or more privileged than the given WaitMode, the thread’s wait will be satisfied with a completion status of STATUS_ALERTED.
If the WaitMode parameter is UserMode and the Alertable parameter is TRUE, the thread can also be awakened to deliver a user-mode APC. Kernel-mode APCs always cause the subject thread to be awakened if the wait IRQL is PASSIVE_LEVEL and no kernel APC is in progress.
The expiration time of the delay is expressed as either an absolute time at which the delay is to expire, or a time relative to the current system time. If the Interval parameter is a negative value, the expiration time is relative.
Callers of KeDelayExecutionThread must be running at IRQL < DISPATCH_LEVEL.
See Also