5.8.WD_Sleep()

Purpose

Delays execution for a specific duration of time.

Prototype
DWORD WD_Sleep(
    HANDLE hWD,
    WD_SLEEP *pSleep);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pSleepWD_SLEEP*
dwMicroSecondsDWORDInput
dwOptionsDWORDInput
Description
NameDescription
hWDHandle to WinDriver's kernel-mode driver as received from WD_Open()[5.2]
pSleepPointer to a sleep information structure
dwMicroSeconds Sleep time in microseconds — 1/1,000,000 of a second
dwOptions A bit-mask, which can be set to either of the following values:
  • Zero (0) — Delay execution by consuming CPU cycles (busy sleep); this is the default.
  • SLEEP_NON_BUSY — Delay execution without consuming CPU resources (non-busy sleep).
    Note: The accuracy of non-busy sleep is machine-dependent and cannot be guaranteed for short sleep intervals (< 1 millisecond).
Return Value

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise[A].

Remarks

Example usage: to access slow response hardware.

Example
WD_Sleep slp;

BZERO(slp);
slp.dwMicroSeconds = 200;
WD_Sleep(hWD, &slp);