.TH timeout() "" "" "Internal Kernel Routine"
.PC "Defer function execution"
.B "#include <kernel/timeout.h>"
\fBvoid timeout(\fItp\^\fB, \fIn\^\fB, \fIfunction\^\fB, \fIa\^\fB)\fR
\fBTIM *\fItp\^\fB; int \fIn\^\fB, (*\fIfunction\^\fB)();\fR
.PP
.B timeout()
sets
.I function
to be called with integer argument
.I a
after
.I n
clock ticks.
.I tp
points to a timing structure to insert into the timing queue.
The timing structure is a static structure located in the kernel's
data segment.
Any previous activation of a timer on the same timing structure
is cancelled.
.PP
Calling
.B timeout()
with
.I function
set to NULL cancels a timer.
A timed function never sleeps or alters the contents of the
.B u
structure.
.PP
To request that the timeout routine for device
.I dev
be called once per second, a driver sets
\fBdrvl[major(\fIdev\^\fB)].d_time\fR to a nonzero value.
.B drvl
is declared in header file
.BR con.h ;
macro
.B major()
is defined in header file
.BR stat.h .
The value in field
.B d_time
is not altered by the kernel clock routines.
A driver stops invocations of the timeout routine by storing a zero in
\fBdrvl[major(\fIdev\^\fB)].d_time\fR.
.SH "See Also"
.B
internal kernel routines
.R
