]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 1993-1995, 1999-2005 Apple Computer, Inc. |
1c79356b A |
3 | * All rights reserved. |
4 | * | |
8ad349bb | 5 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 6 | * |
8ad349bb A |
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@ | |
1c79356b A |
30 | */ |
31 | /* | |
32 | * Declarations for thread-based callouts. | |
1c79356b A |
33 | */ |
34 | ||
35 | #ifndef _KERN_THREAD_CALL_H_ | |
36 | #define _KERN_THREAD_CALL_H_ | |
37 | ||
1c79356b A |
38 | #include <mach/mach_types.h> |
39 | ||
0b4e3aa0 A |
40 | #include <kern/clock.h> |
41 | ||
91447636 A |
42 | #include <sys/cdefs.h> |
43 | ||
1c79356b A |
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); | |
91447636 | 49 | __BEGIN_DECLS |
1c79356b A |
50 | |
51 | boolean_t | |
52 | thread_call_enter( | |
53 | thread_call_t call | |
54 | ); | |
91447636 | 55 | |
1c79356b A |
56 | boolean_t |
57 | thread_call_enter1( | |
58 | thread_call_t call, | |
59 | thread_call_param_t param1 | |
60 | ); | |
91447636 | 61 | |
1c79356b A |
62 | boolean_t |
63 | thread_call_enter_delayed( | |
64 | thread_call_t call, | |
0b4e3aa0 | 65 | uint64_t deadline |
1c79356b | 66 | ); |
91447636 | 67 | |
1c79356b A |
68 | boolean_t |
69 | thread_call_enter1_delayed( | |
70 | thread_call_t call, | |
71 | thread_call_param_t param1, | |
0b4e3aa0 | 72 | uint64_t deadline |
1c79356b | 73 | ); |
91447636 | 74 | |
1c79356b A |
75 | boolean_t |
76 | thread_call_cancel( | |
77 | thread_call_t call | |
78 | ); | |
1c79356b A |
79 | |
80 | thread_call_t | |
81 | thread_call_allocate( | |
82 | thread_call_func_t func, | |
83 | thread_call_param_t param0 | |
84 | ); | |
91447636 | 85 | |
1c79356b A |
86 | boolean_t |
87 | thread_call_free( | |
88 | thread_call_t call | |
89 | ); | |
90 | ||
91447636 A |
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 | |
9bccf70c | 116 | |
91447636 | 117 | __BEGIN_DECLS |
9bccf70c | 118 | |
1c79356b | 119 | /* |
91447636 | 120 | * Obsolete interfaces. |
1c79356b | 121 | */ |
9bccf70c | 122 | |
91447636 A |
123 | boolean_t |
124 | thread_call_is_delayed( | |
125 | thread_call_t call, | |
126 | uint64_t *deadline | |
127 | ); | |
128 | ||
1c79356b A |
129 | void |
130 | thread_call_func( | |
131 | thread_call_func_t func, | |
132 | thread_call_param_t param, | |
133 | boolean_t unique_call | |
134 | ); | |
91447636 | 135 | |
1c79356b A |
136 | void |
137 | thread_call_func_delayed( | |
138 | thread_call_func_t func, | |
139 | thread_call_param_t param, | |
0b4e3aa0 | 140 | uint64_t deadline |
1c79356b A |
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 | ); | |
9bccf70c | 149 | |
91447636 | 150 | #ifndef MACH_KERNEL_PRIVATE |
9bccf70c | 151 | |
91447636 | 152 | #ifndef ABSOLUTETIME_SCALAR_TYPE |
0b4e3aa0 A |
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 | ||
91447636 A |
166 | #endif /* ABSOLUTETIME_SCALAR_TYPE */ |
167 | ||
168 | #endif /* MACH_KERNEL_PRIVATE */ | |
169 | ||
170 | __END_DECLS | |
171 | ||
172 | #endif /* KERNEL_PRIVATE */ | |
0b4e3aa0 | 173 | |
91447636 | 174 | #endif /* _KERN_THREAD_CALL_H_ */ |