]>
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 | * | |
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. | |
12 | * | |
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 | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
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. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /* | |
24 | * Declarations for thread-based callouts. | |
25 | * | |
26 | * HISTORY | |
27 | * | |
28 | * 10 July 1999 (debo) | |
29 | * Pulled into Mac OS X (microkernel). | |
30 | * | |
31 | * 3 July 1993 (debo) | |
32 | * Created. | |
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 | ||
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); | |
47 | ||
48 | boolean_t | |
49 | thread_call_enter( | |
50 | thread_call_t call | |
51 | ); | |
52 | boolean_t | |
53 | thread_call_enter1( | |
54 | thread_call_t call, | |
55 | thread_call_param_t param1 | |
56 | ); | |
57 | boolean_t | |
58 | thread_call_enter_delayed( | |
59 | thread_call_t call, | |
0b4e3aa0 | 60 | uint64_t deadline |
1c79356b A |
61 | ); |
62 | boolean_t | |
63 | thread_call_enter1_delayed( | |
64 | thread_call_t call, | |
65 | thread_call_param_t param1, | |
0b4e3aa0 | 66 | uint64_t deadline |
1c79356b A |
67 | ); |
68 | boolean_t | |
69 | thread_call_cancel( | |
70 | thread_call_t call | |
71 | ); | |
72 | boolean_t | |
73 | thread_call_is_delayed( | |
74 | thread_call_t call, | |
0b4e3aa0 | 75 | uint64_t *deadline |
1c79356b A |
76 | ); |
77 | ||
78 | thread_call_t | |
79 | thread_call_allocate( | |
80 | thread_call_func_t func, | |
81 | thread_call_param_t param0 | |
82 | ); | |
83 | boolean_t | |
84 | thread_call_free( | |
85 | thread_call_t call | |
86 | ); | |
87 | ||
88 | /* | |
89 | * This portion of the interface | |
90 | * is OBSOLETE and DEPRECATED. It | |
91 | * will disappear shortly. | |
92 | */ | |
93 | void | |
94 | thread_call_func( | |
95 | thread_call_func_t func, | |
96 | thread_call_param_t param, | |
97 | boolean_t unique_call | |
98 | ); | |
99 | void | |
100 | thread_call_func_delayed( | |
101 | thread_call_func_t func, | |
102 | thread_call_param_t param, | |
0b4e3aa0 | 103 | uint64_t deadline |
1c79356b A |
104 | ); |
105 | ||
106 | boolean_t | |
107 | thread_call_func_cancel( | |
108 | thread_call_func_t func, | |
109 | thread_call_param_t param, | |
110 | boolean_t cancel_all | |
111 | ); | |
112 | /* End OBSOLETE and DEPRECATED */ | |
113 | ||
114 | #ifdef MACH_KERNEL_PRIVATE | |
115 | #include <kern/call_entry.h> | |
116 | ||
117 | typedef struct call_entry thread_call_data_t; | |
118 | ||
119 | void | |
120 | thread_call_initialize(void); | |
121 | ||
122 | void | |
123 | thread_call_setup( | |
124 | thread_call_t call, | |
125 | thread_call_func_t func, | |
126 | thread_call_param_t param0 | |
127 | ); | |
128 | ||
129 | #endif /* MACH_KERNEL_PRIVATE */ | |
130 | ||
0b4e3aa0 A |
131 | #if !defined(MACH_KERNEL_PRIVATE) && !defined(ABSOLUTETIME_SCALAR_TYPE) |
132 | ||
133 | #include <libkern/OSBase.h> | |
134 | ||
135 | #define thread_call_enter_delayed(a, b) \ | |
136 | thread_call_enter_delayed((a), __OSAbsoluteTime(b)) | |
137 | ||
138 | #define thread_call_enter1_delayed(a, b, c) \ | |
139 | thread_call_enter1_delayed((a), (b), __OSAbsoluteTime(c)) | |
140 | ||
141 | #define thread_call_is_delayed(a, b) \ | |
142 | thread_call_is_delayed((a), __OSAbsoluteTimePtr(b)) | |
143 | ||
144 | #define thread_call_func_delayed(a, b, c) \ | |
145 | thread_call_func_delayed((a), (b), __OSAbsoluteTime(c)) | |
146 | ||
147 | #endif | |
148 | ||
1c79356b | 149 | #endif /* _KERN_THREAD_CALL_H_ */ |