TIMEOUT(9)

NAME
timeout, untimeout - schedule timer events

SYNOPSIS
#include <sys/types.h>
#include <sys/systm.h>
typedef void timeout_t void *;
void
timeout(timeout_t *func, void *arg, int ticks);
void
untimeout(timeout_t *func, void *arg);

DESCRIPTION
The timeout facility allows the execution of a function after a specified amount of time. The function func is being called with the opaque argument arg after ticks timer ticks have been elapsed. It's often convenient to use the external variable hz to compute the amount of ticks to wait.

If the timeout event should be removed before the timer expires, untimeout must be called with the exact func and arg arguments as the corresponding call to timeout().

Unlike the functions of sleep(9), timeout() and untimeout() can be called from within an interrupt context.

SEE ALSO
sleep(9)

HISTORY
The timeout facility is very old.

BUGS
Since the timer queue is sorted and uses time differences rather than absolute times, inserting and removing timer events can be costly if it is done too frequently.

AUTHORS
This man page has been written by Joerg Wunsch.