1qtimeout(9F) Kernel Functions for Drivers qtimeout(9F)
2
3
4
6 qtimeout - execute a function after a specified length of time
7
9 #include <sys/stream.h>
10 #include <sys/ddi.h>
11
12
13 timeout_id_t qtimeout(queue_t *q, void (*func)(void *),
14 void *arg, clock_t ticks);
15
16
18 Solaris DDI specific (Solaris DDI).
19
21 q Pointer to STREAMS queue structure.
22
23
24 func Kernel function to invoke when the time increment expires.
25
26
27 arg Argument to the function.
28
29
30 ticks Number of clock ticks to wait before the function is called.
31 Use drv_usectohz(9F) to convert microseconds to clock ticks.
32
33
35 The qtimeout() function schedules the specified function func to be
36 called after a specified time interval. func is called with arg as a
37 parameter. Control is immediately returned to the caller. This is use‐
38 ful when an event is known to occur within a specific time frame, or
39 when you want to wait for I/O processes when an interrupt is not avail‐
40 able or might cause problems. The exact time interval over which the
41 timeout takes effect cannot be guaranteed, but the value given is a
42 close approximation.
43
44
45 The qtimeout() function is tailored to be used with the enhanced
46 STREAMS framework interface which is based on the concept of perime‐
47 ters. (See mt-streams(9F).) qtimeout() schedules the specified function
48 to execute after entering the perimeters associated with the queue
49 passed in as the first parameter to qtimeout(). All outstanding time‐
50 outs and bufcalls must be cancelled (using, respectively, quntime‐
51 out(9F) and qunbufcall(9F)) before a driver close routine can block and
52 before the close routine calls qprocsoff(9F).
53
54
55 The qprocson(9F) function must be called before calling qtimeout().
56
58 The qtimeout() function returns an opaque non-zero timeout identifier
59 that can be passed to quntimeout(9F) to cancel the request. Note: No
60 value is returned from the called function.
61
63 The qtimeout() function can be called from user, interrupt, or kernel
64 context.
65
67 drv_usectohz(9F), mt-streams(9F), qbufcall(9F), qprocson(9F), qunbuf‐
68 call(9F), quntimeout(9F)
69
70
71 Writing Device Drivers
72
73
74 STREAMS Programming Guide
75
76
77
78SunOS 5.11 16 Jan 2006 qtimeout(9F)