 |
Index for Section 9r |
|
 |
Alphabetical listing for T |
|
 |
Bottom of page |
|
timeout(9r)
NAME
timeout - General: Initializes a callout queue element
SYNOPSIS
void timeout(
int (*function) (),
caddr_t argument,
register int time );
ARGUMENTS
function
Specifies a pointer to the routine to be called.
argument
Specifies a single argument to be passed to the called routine.
time
Specifies the amount of time to delay before calling the specified
routine. You express time as time (in seconds) * hz.
DESCRIPTION
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);
NOTES
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.
RETURN VALUES
None
SEE ALSO
Routines: untimeout(9r)
 |
Index for Section 9r |
|
 |
Alphabetical listing for T |
|
 |
Top of page |
|