]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 1993-1995, 1999-2005 Apple Computer, Inc. | |
3 | * All rights reserved. | |
4 | * | |
5 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ | |
6 | * | |
7 | * This file contains Original Code and/or Modifications of Original Code | |
8 | * as defined in and that are subject to the Apple Public Source License | |
9 | * Version 2.0 (the 'License'). You may not use this file except in | |
10 | * compliance with the License. The rights granted to you under the | |
11 | * License may not be used to create, or enable the creation or | |
12 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
13 | * system, or to circumvent, violate, or enable the circumvention or | |
14 | * violation of, any terms of an Apple operating system software license | |
15 | * agreement. | |
16 | * | |
17 | * Please obtain a copy of the License at | |
18 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
19 | * file. | |
20 | * | |
21 | * The Original Code and all software distributed under the License are | |
22 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
23 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
24 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
25 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
26 | * Please see the License for the specific language governing rights and | |
27 | * limitations under the License. | |
28 | * | |
29 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
30 | */ | |
31 | /* | |
32 | * Declarations for thread-based callouts. | |
33 | */ | |
34 | ||
35 | #ifndef _KERN_THREAD_CALL_H_ | |
36 | #define _KERN_THREAD_CALL_H_ | |
37 | ||
38 | #include <mach/mach_types.h> | |
39 | ||
40 | #include <kern/clock.h> | |
41 | ||
42 | #include <sys/cdefs.h> | |
43 | ||
44 | typedef struct call_entry *thread_call_t; | |
45 | typedef void *thread_call_param_t; | |
46 | typedef void (*thread_call_func_t)( | |
47 | thread_call_param_t param0, | |
48 | thread_call_param_t param1); | |
49 | __BEGIN_DECLS | |
50 | ||
51 | boolean_t | |
52 | thread_call_enter( | |
53 | thread_call_t call | |
54 | ); | |
55 | ||
56 | boolean_t | |
57 | thread_call_enter1( | |
58 | thread_call_t call, | |
59 | thread_call_param_t param1 | |
60 | ); | |
61 | ||
62 | boolean_t | |
63 | thread_call_enter_delayed( | |
64 | thread_call_t call, | |
65 | uint64_t deadline | |
66 | ); | |
67 | ||
68 | boolean_t | |
69 | thread_call_enter1_delayed( | |
70 | thread_call_t call, | |
71 | thread_call_param_t param1, | |
72 | uint64_t deadline | |
73 | ); | |
74 | ||
75 | boolean_t | |
76 | thread_call_cancel( | |
77 | thread_call_t call | |
78 | ); | |
79 | ||
80 | thread_call_t | |
81 | thread_call_allocate( | |
82 | thread_call_func_t func, | |
83 | thread_call_param_t param0 | |
84 | ); | |
85 | ||
86 | boolean_t | |
87 | thread_call_free( | |
88 | thread_call_t call | |
89 | ); | |
90 | ||
91 | __END_DECLS | |
92 | ||
93 | #ifdef MACH_KERNEL_PRIVATE | |
94 | ||
95 | #include <kern/call_entry.h> | |
96 | ||
97 | typedef struct call_entry thread_call_data_t; | |
98 | ||
99 | void | |
100 | thread_call_initialize(void); | |
101 | ||
102 | void | |
103 | thread_call_setup( | |
104 | thread_call_t call, | |
105 | thread_call_func_t func, | |
106 | thread_call_param_t param0 | |
107 | ); | |
108 | ||
109 | void | |
110 | call_thread_block(void), | |
111 | call_thread_unblock(void); | |
112 | ||
113 | #endif /* MACH_KERNEL_PRIVATE */ | |
114 | ||
115 | #ifdef KERNEL_PRIVATE | |
116 | ||
117 | __BEGIN_DECLS | |
118 | ||
119 | /* | |
120 | * Obsolete interfaces. | |
121 | */ | |
122 | ||
123 | boolean_t | |
124 | thread_call_is_delayed( | |
125 | thread_call_t call, | |
126 | uint64_t *deadline | |
127 | ); | |
128 | ||
129 | void | |
130 | thread_call_func( | |
131 | thread_call_func_t func, | |
132 | thread_call_param_t param, | |
133 | boolean_t unique_call | |
134 | ); | |
135 | ||
136 | void | |
137 | thread_call_func_delayed( | |
138 | thread_call_func_t func, | |
139 | thread_call_param_t param, | |
140 | uint64_t deadline | |
141 | ); | |
142 | ||
143 | boolean_t | |
144 | thread_call_func_cancel( | |
145 | thread_call_func_t func, | |
146 | thread_call_param_t param, | |
147 | boolean_t cancel_all | |
148 | ); | |
149 | ||
150 | #ifndef MACH_KERNEL_PRIVATE | |
151 | ||
152 | #ifndef ABSOLUTETIME_SCALAR_TYPE | |
153 | ||
154 | #define thread_call_enter_delayed(a, b) \ | |
155 | thread_call_enter_delayed((a), __OSAbsoluteTime(b)) | |
156 | ||
157 | #define thread_call_enter1_delayed(a, b, c) \ | |
158 | thread_call_enter1_delayed((a), (b), __OSAbsoluteTime(c)) | |
159 | ||
160 | #define thread_call_is_delayed(a, b) \ | |
161 | thread_call_is_delayed((a), __OSAbsoluteTimePtr(b)) | |
162 | ||
163 | #define thread_call_func_delayed(a, b, c) \ | |
164 | thread_call_func_delayed((a), (b), __OSAbsoluteTime(c)) | |
165 | ||
166 | #endif /* ABSOLUTETIME_SCALAR_TYPE */ | |
167 | ||
168 | #endif /* MACH_KERNEL_PRIVATE */ | |
169 | ||
170 | __END_DECLS | |
171 | ||
172 | #endif /* KERNEL_PRIVATE */ | |
173 | ||
174 | #endif /* _KERN_THREAD_CALL_H_ */ |