DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

drv_usecwait(D3)


drv_usecwait -- busy-wait for specified interval

Synopsis

   #include <sys/types.h>
   #include <sys/ddi.h>
   

void drv_usecwait(clock_t microsecs);

Description

drv_usecwait causes the caller to busy-wait for at least the number of microseconds specified by microsecs. The amount of time spent busy-waiting may be greater than the time specified by microsecs but will not be less.

Arguments


microsecs
The number of microseconds to busy-wait.

Return values

None

Usage

drv_usecwait should only be used to wait for short periods of time (less than a clock tick) or when it is necessary to wait without sleeping (for example, at interrupt level). When the desired delay is at least as long as clock tick and it is possible to sleep, the delay(D3) function should be used instead since it will not waste processor time busy-waiting as drv_usecwait does.

Because excessive busy-waiting is wasteful the driver should only make calls to drv_usecwait as needed, and only for as much time as needed. drv_usecwait does not raise the interrupt priority level; if the driver wishes to block interrupts for the duration of the wait, it is the driver's responsibility to set the priority level before the call and restore it to its original value afterward.

Context and synchronization

All contexts.

Warnings

Busy-waiting can increase the preemption latency experienced by high priority processes. Since short and bounded preemption latency can be critical in a real time environment, drivers intended for use in such an environment should not use this function or should limit the length of the wait to an appropriately short length of time.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

SCO OpenServer ODDI compatibility

ODDI drivers use the suspend(D3oddi) function in place of drv_usecwait( ).

References

delay(D3), drv_hztousec(D3), drv_usectohz(D3), itimeout(D3), timeout(D3), untimeout(D3)

``Delays and busy-waits'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005