Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

biodone(9F)

biowait(9F)

bufcall(9F)

delay(9F)

untimeout(9F)

timeout(9F)

NAME

timeout − execute a function after a specified length of time

SYNOPSIS

#include <sys/types.h>
int timeout(void (∗ftn)(), caddr_t arg, long ticks
);

ARGUMENTS

ftn Kernel function to invoke when the time increment expires. 

arg Argument to the function. 

ticks Number of clock ticks to wait before the function is called. 

INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI). 

DESCRIPTION

The timeout() function  schedules the specified function to be called after a specified time interval.  Control is immediately returned to the caller. This is useful when an event is known to occur within a specific time frame, or when you want to wait for I/O processes when an interrupt is not available or might cause problems.  For example, some robotics applications do not provide a status flag for determining when to pump information to the robot’s controller.  By using timeout, the driver can wait a predetermined interval and then begin transferring data to the robot. 

The exact time interval over which the timeout takes effect cannot be guaranteed, but the value given is a close approximation.  The function called by timeout() must adhere to the same restrictions as a driver interrupt handler.  It can neither sleep nor use previously set local variables. 

RETURN VALUES

Under normal conditions, an integer timeout identifier is returned (which may, in unusual circumstances, be set to 0).  Otherwise, if the timeout() table is full, the following panic message results:

PANIC:  Timeout table overflow
 

The timeout() function returns an identifier that may be passed to the untimeout(9F) function to cancel a pending request.  NOTE: No value is returned from the called function. 

CONTEXT

timeout() can be called from user or interrupt context. 

EXAMPLE

See the bufcall(9F) function page for an example of timeout(). 

SEE ALSO

biodone(9F), biowait(9F), bufcall(9F), delay(9F), untimeout(9F),

SunOS 5.1 Writing Device Drivers

SunOS 5.1/SPARC  —  Last change: 11 Apr 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026