FreeBSD/Linux Kernel Cross Reference
sys/man/timer_arm.man
1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1993 Carnegie Mellon University
4 .\" All Rights Reserved.
5 .\"
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
11 .\"
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 .\"
16 .\" Carnegie Mellon requests users of this software to return to
17 .\"
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
22 .\"
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
25 .\"
26 .\"
27 .\" HISTORY
28 .\" $Log: timer_arm.man,v $
29 .\" Revision 2.2 93/12/07 14:00:44 dbg
30 .\" Created.
31 .\"
32 .\"
33 .TH timer_arm 2 9/22/93
34 .CM 4
35 .SH NAME
36 .nf
37 timer_arm \- arm a timer to expire
38 .SH SYNOPSIS
39 .nf
40 .ft B
41 #include <mach.h>
42
43 .nf
44 .ft B
45 kern_return_t
46 timer_arm(
47 mach_timer_t timer,
48 time_spec_t expire_time,
49 time_spec_t interval_time,
50 mach_port_t expire_port,
51 thread_t thread,
52 int flags);
53
54
55 .fi
56 .ft P
57 .SH ARGUMENTS
58 .TP 15
59 .B
60 timer
61 The timer to arm.
62 .TP 15
63 .B expire_time
64 The time at which the timer will expire, measured
65 against
66 .B timer's
67 clock.
68 .TP 15
69 .B interval_time
70 The interval at which the timer will again expire,
71 if the timer is set to expire periodically.
72 .TP 15
73 .B expire_port
74 A send right to a port to which the timer expiration
75 message will be sent.
76 .TP 15
77 .B thread
78 A thread to suspend when the timer expires, or
79 THREAD_NULL if none.
80 .TP 15
81 .B flags
82 Options for the expiration time and the action
83 to be taken.
84
85
86 .SH DESCRIPTION
87 .B timer_arm
88 sets a timer to expire at a particular time, and,
89 optionally, to expire at periodic intervals after
90 that time. The expiration time may be specified
91 as absolute, if
92 .B TIMER_ABSOLUTE
93 is set in
94 .B flags;
95 otherwise, the expiration time is relative to
96 the current time (of
97 .B timer's
98 clock). If
99 .B TIMER_PERIODIC
100 is set in
101 .B flags,
102 the timer will expire at
103 .B expire_time,
104 and at every
105 .B interval_time
106 interval afterwards.
107
108 When the timer expires, a
109 .B timer_expire
110 message is sent to
111 .B expire_port.
112 The message contains the absolute time at which
113 the timer expired. If the timer is periodic,
114 the message will be sent at the end of every
115 period. However, if
116 .B expire_port
117 is full (its message queue exceeds its queue limit),
118 the message will not be sent. Instead, the timer's
119 .B overrun count
120 will be incremented. At the next timer expiration
121 when the message can successfully be sent, the
122 overrun count will be added to the timer expiration
123 message, and the timer's overrun count will be reset
124 to zero.
125
126 If
127 .B TIMER_THREAD_SUSPEND
128 is set in
129 .B flags,
130 the specified thread will be suspended when the timer expires.
131 If the thread is blocked in an uninterruptible wait within
132 the Mach kernel, it is not guaranteed to be completely suspended
133 by the time the timer_expire message is delivered. The receiver
134 of the message can issue a thread_get_state call to ensure that
135 the suspension is complete. The suspended thread can be
136 resumed with the thread_resume call.
137
138 If the timer is set to be periodic, the thread will be suspended
139 again at the end of each period (unless the current interval is
140 canceled with
141 .B timer_cancel). Thread_resume must be called as many times
142 as the thread was suspended to make the thread run again.
143
144 .SH DIAGNOSTICS
145 .TP 25
146 KERN_SUCCESS
147 Operation completed successfully
148 .TP 25
149 KERN_INVALID_ARGUMENT
150 .B timer
151 is not a timer, or
152 .B expire_time
153 or
154 .B interval_time
155 is not a valid time specification, or
156 .B interval_time
157 is less than the resolution of
158 .B timer's
159 clock, or
160 .B expire_port
161 is not a valid port, or
162 .B thread
163 is not a valid thread.
164
165 .TP 25
166 KERN_FAILURE
167 .B timer
168 is currently armed.
169
170 .SH BUGS
171
172 .SH SEE ALSO
173 .B timer_create, timer_terminate, timer_sleep, timer_cancel.
174
Cache object: 600bf30406cfce975e024cedf617c50d
|