itimeout(D3DK) —
.IX \f4itimeout\fP(D3DK)
NAME
itimeout − execute a function after a specified length of time
SYNOPSIS
#include <sys/types.h>
toid_t itimeout(void (∗fn)(), void ∗arg, long ticks, pl_t pl);
ARGUMENTS
fnFunction to execute when the time increment expires.
argArgument to the function.
ticksNumber of clock ticks to wait before the function is called.
plThe interrupt priority level at which the function will be called. pl must specify a priority level greater than or equal to pltimeout; thus, plbase cannot be used. See LOCK_ALLOC(D3DK) for a list of values for pl.
DESCRIPTION
itimeout causes the function specified by fn to be called after the time interval specified by ticks, at the interrupt priority level specified by pl. arg will be passed as the only argument to function fn. The itimeout call returns immediately without waiting for the specified function to execute.
The length of time before the function is called is not guaranteed to be exactly equal to the requested time, but will be at least ticks−1 clock ticks in length. The function specified by fn must neither sleep nor reference process context.
RETURN VALUE
If the function specified by fn is successfully scheduled, itimeout returns a non-zero identifier that can be passed to untimeout to cancel the request. If the function could not be scheduled, itimeout returns a value of 0.
LEVEL
Base or Interrupt.
NOTES
Does not sleep. Driver defined basic locks, read/write locks, and sleep locks may be held across calls to this function. Drivers should be careful to cancel any pending timeout functions that access data structures before these structures are de-initialized or deallocated. After the time interval has expired, fn only runs if the processor is at base level. Otherwise, fn is deferred until some time in the near future. If itimeout is called holding a lock that is contended for by fn, the caller must hold the lock at a processor level greater than the base processor level. A ticks argument of 0 has the same effect as a ticks argument of 1. Both will result in an approximate wait of between 0 and 1 tick (possibly longer).
SEE ALSO
dtimeout(D3DK), LOCK_ALLOC(D3DK), untimeout(D3DK)
EXAMPLE
See copyb(D3DK) for an example of itimeout.
DDI/DKI