timeout Kernel Service

Attention: This service must not be used because it is not multi-processor safe. The base kernel timer and watchdog services must be used instead.

Purpose

Schedules a function to be called after a specified interval.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
void timeout ( func,  arg,  ticks)
void (*func)();
caddr_t *arg;
int ticks;

Parameters

Item Description
func Indicates the function to be called.
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 per second. The HZ label that is found in the /usr/include/sys/m_param.h file can be used to determine the number of ticks per second.

Description

The timeout service is not part of the kernel. However, it is a compatibility service that is provided in the libsys.a library. To use the timeout service, a kernel extension must be bound with the libsys.a library. The timeout service, like the associated kernel services untimeout and timeoutcf, can be bound and used only in the pinned part of a kernel extension or the bottom half of a device driver because these services use interrupt disable for serialization.

The timeout service schedules the function pointed to by the func parameter to be called with the arg parameter after the number of timer ticks that are specified by the ticks parameter. Use the timeoutcf routine to allocate enough callout elements for the maximum number of simultaneous active time outs that you expect.

Note: The timeoutcf routine must be called before the timeout service is called.

Calling the timeout service without allocating enough callout table entries can result in a kernel panic because of a lack of pinned callout table elements. The value of a timer tick depends on the hardware's capability. You can use the restimer subroutine to determine the minimum granularity.

Multiple pending timeout requests with the same func and arg parameters are not allowed.

The func Parameter

The function that is specified by the func parameter must be declared as follows:

void func (arg)
void *arg;

Execution Environment

The timeout routine can be called from either the process or interrupt environment.

The function that is specified by the func parameter is called in the interrupt environment. Therefore, it must follow the conventions for interrupt handlers.

Return Values

The timeout service has no return values.