]> git.saurik.com Git - apple/xnu.git/blob - osfmk/man/clock_sleep.html
xnu-2422.1.72.tar.gz
[apple/xnu.git] / osfmk / man / clock_sleep.html
1 <h2>clock_sleep</h2>
2 <hr>
3 <p>
4 <strong>System Trap</strong> - Sleep until a given time.
5 <h3>SYNOPSIS</h3>
6 <pre>
7 <strong>kern_return_t clock_sleep</strong>
8 <strong>(mach_port_t</strong> <var>clock_name</var>,
9 <strong>sleep_type_t</strong> <var>sleep_type</var>,
10 <strong>tvalspec_t</strong> <var>sleep_time</var>,
11 <strong>clock_name</strong> <var>wake_time</var><strong>);</strong>
12 </pre>
13 <h3>PARAMETERS</h3>
14 <dl>
15 <p>
16 <dt><var>clock_name</var>
17 <dd>
18 [in clock-name send right] The name (or control) port for the clock.
19 <p>
20 <dt><var>sleep_type</var>
21 <dd>
22 [in scalar] How to interpret the sleep_time value:
23 <dl>
24 <p>
25 <dt><strong>TIME_RELATIVE</strong>
26 <dd>
27 Interpret the sleep time as relative to the current time.
28 <p>
29 <dt><strong>TIME_ABSOLUTE</strong>
30 <dd>
31 Interpret the sleep time as an absolute time.
32 </dl>
33 <p>
34 <dt><var>sleep_time</var>
35 <dd>
36 [in structure] The time when the sleep is to terminate.
37 <p>
38 <dt><var>wake_time</var>
39 <dd>
40 [out structure] The actual (absolute) time at which the sleep terminated.
41 </dl>
42
43 <h3>DESCRIPTION</h3>
44 <p>
45 The <strong>clock_sleep</strong> system trap delays the invoking
46 thread until a specified time. This sleep may be aborted by
47 <strong>thread_abort</strong>. Not all clocks provide this service
48 but the REALTIME clock must.
49 <p>
50 If the specified time is in the past, the call returns immediately
51 with the wake time being the current time. If the clock's time is
52 changed (<strong>clock_set_time</strong>), the sleep will be
53 interrupted. The thread will waken at the service time nearest the
54 specified sleep time as governed by the current clock alarm
55 resolution.
56 <h3>RETURN VALUES</h3>
57 <dl>
58 <p>
59 <dt> <strong>KERN_FAILURE</strong>
60 <dd>
61 The clock does not support a sleep service.
62 <p>
63 <dt> <strong>KERN_ABORTED</strong>
64 <dd>
65 The sleep was interrupted by thread_abort or terminated via use of
66 clock_set_time.
67 </dl>
68 <h3>RELATED INFORMATION</h3>
69 <p>
70 Functions:
71 <a href="host_get_clock_service.html"><strong>host_get_clock_service</strong></a>,
72 <a href="clock_get_attributes.html"><strong>clock_get_attributes</strong></a>,
73 <a href="clock_get_time.html"><strong>clock_get_time</strong></a>,
74 <a href="clock_alarm.html"><strong>clock_alarm</strong></a>,
75 <a href="clock_set_time.html"><strong>clock_set_time</strong></a>,
76 <a href="thread_abort.html"><strong>thread_abort</strong></a>,
77 <p>
78 Data Structures:
79 tvalspec.