timeout Kernel Service

Attention: This service should not be used in AIX® Version 4, because it is not multi-processor safe. The base kernel timer and watchdog services should be used instead. See talloc and w_init for more information.

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 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 provided in the libsys.a library. To use the timeout service, a kernel extension must have been 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 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 calling the timeout service.

Calling the timeout service without allocating a sufficient number of 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 specified by the func parameter should 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 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.