delay(9F)

NAME

SYNOPSIS

#include <sys/ddi.h>

void delay(clock_t ticks);

INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI).

PARAMETERS

ticks

The number of clock cycles to delay.

DESCRIPTION

delay() provides a mechanism for a driver to delay its execution for a given period of time. Since the speed of the clock varies among systems, drivers
should base their time values on microseconds and use drv_usectohz(9F) to convert microseconds into clock ticks.

delay() uses timeout(9F) to schedule an internal function to be called after the specified amount of time has elapsed. delay() then waits until
the function is called. Because timeout() is subject to priority inversion, drivers waiting on behalf of processes with real-time constraints should use cv_timedwait(9F)
rather than delay().

CONTEXT

delay() can be called from user and kernel contexts.

EXAMPLES

Example 1 delay() Example

Before a driver I/O routine allocates buffers and stores any user data in them, it checks the status of the device (line 12). If the device needs manual intervention (such as, needing to be refilled with paper), a message is displayed on the system console (line 14). The driver waits an allotted
time (line 17) before repeating the procedure.