itimeout(D3) itimeout(D3)
NAME
itimeout - execute a function after a specified length of time
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
toid_t itimeout(void (*func)(), void *arg, long ticks, pl_t pl);
Arguments
func Function to execute when the time increment expires.
arg Argument to the function.
ticks Number of clock ticks to wait before the function is
called.
pl The interrupt priority level at which the function
will be called.
DESCRIPTION
itimeout causes the function specified by func 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 func. The itimeout call returns
immediately without waiting for the specified function to
execute.
Return Values
If the function specified by func 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.
USAGE
pl must specify a priority level greater than or equal to
pltimeout; thus, plbase cannot be used. See LOCK_ALLOC(D3)
for a list of values for pl.
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 func must neither sleep, reference
process context, nor lower the interrupt priority level below
pl.
Copyright 1994 Novell, Inc. Page 1
itimeout(D3) itimeout(D3)
After the time interval has expired, func only runs if the
processor is at base level. Otherwise, func is deferred until
some time in the near future.
If itimeout is called holding a lock that is contended for by
func, 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).
The flag TO_PERIODIC can be logically OR'ed into the ticks
argument to indicate a repeating periodic timer. When this is
used, the specified function will be called every ticks clock
ticks, instead of just once; successive calls will compensate
for any delay in a previous cycle, so that there is no
cumulative drift. The repeating timer can be canceled by
untimeout(D3), just like any other timeout.
Drivers should be careful to cancel any pending itimeout
functions that access data structures before these structures
are de-initialized or deallocated.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
Examples
See copyb(D3) for an example of itimeout.
REFERENCES
dtimeout(D3), LOCK_ALLOC(D3), untimeout(D3)
NOTICES
Portability
All processors
Applicability
ddi: 3, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2