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