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