timeout Utility

Purpose

Schedules a function to be called after a specified interval.

Syntax

int
timeout(func, arg, ticks)
int (* func)();
caddr_t  arg;
long  ticks;

Description

The timeout utility schedules the function pointed to by the func parameter to be called with the arg parameter after the number of timer ticks specified by the ticks parameter. Multiple pending calls to the timeout utility with the same func and arg parameters are allowed. The function called by the timeout utility must adhere to the same restrictions as a driver interrupt handler. It must not sleep.

On multiprocessor systems, the function called by the timeout utility should be interrupt-safe. Otherwise, the STR_QSAFETY flag must be set when installing the module or driver with the str_install utility.

This utility is part of STREAMS Kernel Extension.

Note: This utility must not be confused with the kernel service of the same name in the libsys.a library. STREAMS modules and drivers inherently use this version, not the libsys.a library version. No special action is required to use this version in the STREAMS environment.

Parameters

Item Description
func Indicates the function to be called. The function is declared as follows:
void (*func)(arg)
void *arg;
arg Indicates the parameter to supply to the function specified by the func parameter.
ticks Specifies the number of timer ticks that must occur before the function specified by the func parameter is called. Many timer ticks can occur every second.

Return Values

The timeout utility returns an integer that identifies the request. This value may be used to withdraw the time-out request by using the untimeout utility. If the timeout table is full, the timeout utility returns a value of 0 and the request is not registered.

Execution Environment

The timeout utility may be called from either the process or interrupt environment.