]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1993-1995, 1999-2000 Apple Computer, Inc. | |
3 | * All rights reserved. | |
4 | * | |
5 | * @APPLE_LICENSE_HEADER_START@ | |
6 | * | |
43866e37 | 7 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 8 | * |
43866e37 A |
9 | * This file contains Original Code and/or Modifications of Original Code |
10 | * as defined in and that are subject to the Apple Public Source License | |
11 | * Version 2.0 (the 'License'). You may not use this file except in | |
12 | * compliance with the License. Please obtain a copy of the License at | |
13 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
14 | * file. | |
15 | * | |
16 | * The Original Code and all software distributed under the License are | |
17 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
18 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
19 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
20 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
21 | * Please see the License for the specific language governing rights and | |
22 | * limitations under the License. | |
1c79356b A |
23 | * |
24 | * @APPLE_LICENSE_HEADER_END@ | |
25 | */ | |
26 | /* | |
27 | * Declarations for thread-based callouts. | |
28 | * | |
29 | * HISTORY | |
30 | * | |
31 | * 10 July 1999 (debo) | |
32 | * Pulled into Mac OS X (microkernel). | |
33 | * | |
34 | * 3 July 1993 (debo) | |
35 | * Created. | |
36 | */ | |
37 | ||
38 | #ifndef _KERN_THREAD_CALL_H_ | |
39 | #define _KERN_THREAD_CALL_H_ | |
40 | ||
9bccf70c A |
41 | #include <sys/appleapiopts.h> |
42 | ||
1c79356b A |
43 | #include <mach/mach_types.h> |
44 | ||
0b4e3aa0 A |
45 | #include <kern/clock.h> |
46 | ||
1c79356b A |
47 | typedef struct call_entry *thread_call_t; |
48 | typedef void *thread_call_param_t; | |
49 | typedef void (*thread_call_func_t)( | |
50 | thread_call_param_t param0, | |
51 | thread_call_param_t param1); | |
52 | ||
53 | boolean_t | |
54 | thread_call_enter( | |
55 | thread_call_t call | |
56 | ); | |
57 | boolean_t | |
58 | thread_call_enter1( | |
59 | thread_call_t call, | |
60 | thread_call_param_t param1 | |
61 | ); | |
62 | boolean_t | |
63 | thread_call_enter_delayed( | |
64 | thread_call_t call, | |
0b4e3aa0 | 65 | uint64_t deadline |
1c79356b A |
66 | ); |
67 | boolean_t | |
68 | thread_call_enter1_delayed( | |
69 | thread_call_t call, | |
70 | thread_call_param_t param1, | |
0b4e3aa0 | 71 | uint64_t deadline |
1c79356b A |
72 | ); |
73 | boolean_t | |
74 | thread_call_cancel( | |
75 | thread_call_t call | |
76 | ); | |
77 | boolean_t | |
78 | thread_call_is_delayed( | |
79 | thread_call_t call, | |
0b4e3aa0 | 80 | uint64_t *deadline |
1c79356b A |
81 | ); |
82 | ||
83 | thread_call_t | |
84 | thread_call_allocate( | |
85 | thread_call_func_t func, | |
86 | thread_call_param_t param0 | |
87 | ); | |
88 | boolean_t | |
89 | thread_call_free( | |
90 | thread_call_t call | |
91 | ); | |
92 | ||
9bccf70c A |
93 | #ifdef __APPLE_API_PRIVATE |
94 | ||
95 | #ifdef __APPLE_API_OBSOLETE | |
96 | ||
1c79356b A |
97 | /* |
98 | * This portion of the interface | |
99 | * is OBSOLETE and DEPRECATED. It | |
100 | * will disappear shortly. | |
101 | */ | |
9bccf70c | 102 | |
1c79356b A |
103 | void |
104 | thread_call_func( | |
105 | thread_call_func_t func, | |
106 | thread_call_param_t param, | |
107 | boolean_t unique_call | |
108 | ); | |
109 | void | |
110 | thread_call_func_delayed( | |
111 | thread_call_func_t func, | |
112 | thread_call_param_t param, | |
0b4e3aa0 | 113 | uint64_t deadline |
1c79356b A |
114 | ); |
115 | ||
116 | boolean_t | |
117 | thread_call_func_cancel( | |
118 | thread_call_func_t func, | |
119 | thread_call_param_t param, | |
120 | boolean_t cancel_all | |
121 | ); | |
9bccf70c | 122 | |
1c79356b A |
123 | /* End OBSOLETE and DEPRECATED */ |
124 | ||
9bccf70c A |
125 | #endif /* __APPLE_API_OBSOLETE */ |
126 | ||
1c79356b A |
127 | #ifdef MACH_KERNEL_PRIVATE |
128 | #include <kern/call_entry.h> | |
129 | ||
130 | typedef struct call_entry thread_call_data_t; | |
131 | ||
132 | void | |
133 | thread_call_initialize(void); | |
134 | ||
135 | void | |
136 | thread_call_setup( | |
137 | thread_call_t call, | |
138 | thread_call_func_t func, | |
139 | thread_call_param_t param0 | |
140 | ); | |
141 | ||
9bccf70c A |
142 | void |
143 | call_thread_block(void), | |
144 | call_thread_unblock(void); | |
145 | ||
1c79356b A |
146 | #endif /* MACH_KERNEL_PRIVATE */ |
147 | ||
9bccf70c A |
148 | #endif /* __APPLE_API_PRIVATE */ |
149 | ||
0b4e3aa0 A |
150 | #if !defined(MACH_KERNEL_PRIVATE) && !defined(ABSOLUTETIME_SCALAR_TYPE) |
151 | ||
152 | #include <libkern/OSBase.h> | |
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 | |
167 | ||
1c79356b | 168 | #endif /* _KERN_THREAD_CALL_H_ */ |