DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

timeout(D3)


timeout -- execute a function after a specified length of time

Synopsis (Not in current DDI version)

   #include <sys/types.h>
   #include <sys/ddi.h>
   

int timeout(void (*fn)(), caddr_t arg, long ticks);

Description

timeout schedules the specified function to be called after the time interval specified by ticks. arg will be passed as the only argument to function fn. The timeout call returns immediately without waiting for the specified function to execute.

Arguments


fn
Function to execute when the time increment expires. The function specified by fn runs in interrupt context in HDK Technical Reference and must not lower the interrupt priority below that specified by the plhi argument." fn will be run at some point after the time interval expires. Like a device interrupt (see intr(D2)), it may need to be deferred until the interrupt priority is dropped to a sufficiently low level. Timer callback functions are only run when the interrupt priority level is plbase; they never interrupt device interrupt handlers.

arg
Argument to the function.

ticks
Number of clock ticks to wait before the function is called. The length of time before the function is called is not guaranteed to be exactly equal to the requested time, but will be at least ticks clock ticks in length. If ticks specifies the value zero, this implies that the function should be run as soon as possible.

Return values

If the function specified by fn is successfully scheduled, timeout( ) returns an identifier that can be passed to the untimeout(D3) function to cancel the request. If the function could not be scheduled (because the timeout table is full), the following panic message results:
   PANIC:  Timeout table overflow

Usage

Drivers should be careful to cancel any pending timeout functions that access data structures before these structures are de-initialized or deallocated.

Context and synchronization

Non-blockable, interrupt, user, or blockable context.

Examples

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

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp

Differences between versions

Beginning with DDI version 7 (and supported beginning with DDI version 3), the itimeout(D3) function replaces the timeout( ) function. itimeout( ) returns an error instead of causing a panic when no more space is available, so drivers can handle the error, which improves system reliability and availability. itimeout( ) also allows the driver to select an interrupt priority other than plhi.

SCO OpenServer provides the timeout(D3oddi) function, which is similar to the DDI timeout( ) function, although the casting of the arguments are different.

SCO OpenServer ODDI compatibility

ODDI drivers use the timeout(D3oddi) or nano_timeout(D3oddi) function for all timeouts.

UDI compatibility

UDI drivers use udi_timer_start( ) in place of timeout( ) and udi_timer_cancel( ) in place of untimeout( ). udi_timer_start_repeating( ) is similar to timeout( ) with the TO_PERIODIC flag.

References

bufcall(D3str), delay(D3), drv_usectohz(D3), timeout(D3oddi) untimeout(D3)

``Timeouts'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005