timeout - General: Initializes a callout queue element
void timeout(
int (*function) (),
caddr_t argument,
register int time );
Specifies a pointer to the routine to be called. Specifies
a single argument to be passed to the called routine.
Specifies the amount of time to delay before calling the
specified routine. You express time as time (in seconds) *
hz.
The timeout routine initializes a callout queue element to
make it easy to execute the specified routine at the time
specified in the time argument. You often use callout routines
for infrequent polling or error handling. The routine
you specify will be called on the interrupt stack
(not in processor context) as dispatched from the softclock
routine.
The global variable hz contains the number of clock ticks
per second. This variable is a second's worth of clock
ticks.
Thus, if you wanted a 4-minute timeout, you would pass 4 *
60 * hz as the third argument to the timeout routine as
follows:
/* A 4-minute timeout */
.
.
.
timeout(lptout, (caddr_t)dev, 4 * 60 * hz);
The granularity of the time delay is dependent on the
hardware. For example, the granularity of some Alpha CPUs
is 1024 clock ticks per second. Other Alpha CPUs have a
granularity of 1200 clock ticks per second. Still other
Alpha CPUs exhibit a granularity of 128 clock ticks per
second. Because the granularity of the time delay is
dependent on the hardware, the operating system provides
the hz and lbolt global variables. Use the hz global variable
to determine the number of clock ticks per second for
a specific Alpha CPU. Use the lbolt global variable as a
periodic wakeup mechanism.
None
Routines: untimeout(9r)
timeout(9r)
[ Back ] |