]> git.saurik.com Git - apple/xnu.git/blame_incremental - osfmk/kern/thread_call.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / kern / thread_call.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1993-1995, 1999-2005 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 *
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@
30 */
31/*
32 * Declarations for thread-based callouts.
33 */
34
35#ifndef _KERN_THREAD_CALL_H_
36#define _KERN_THREAD_CALL_H_
37
38#include <mach/mach_types.h>
39
40#include <kern/clock.h>
41
42#include <sys/cdefs.h>
43
44typedef struct call_entry *thread_call_t;
45typedef void *thread_call_param_t;
46typedef void (*thread_call_func_t)(
47 thread_call_param_t param0,
48 thread_call_param_t param1);
49__BEGIN_DECLS
50
51boolean_t
52thread_call_enter(
53 thread_call_t call
54);
55
56boolean_t
57thread_call_enter1(
58 thread_call_t call,
59 thread_call_param_t param1
60);
61
62boolean_t
63thread_call_enter_delayed(
64 thread_call_t call,
65 uint64_t deadline
66);
67
68boolean_t
69thread_call_enter1_delayed(
70 thread_call_t call,
71 thread_call_param_t param1,
72 uint64_t deadline
73);
74
75boolean_t
76thread_call_cancel(
77 thread_call_t call
78);
79
80thread_call_t
81thread_call_allocate(
82 thread_call_func_t func,
83 thread_call_param_t param0
84);
85
86boolean_t
87thread_call_free(
88 thread_call_t call
89);
90
91__END_DECLS
92
93#ifdef MACH_KERNEL_PRIVATE
94
95#include <kern/call_entry.h>
96
97typedef struct call_entry thread_call_data_t;
98
99void
100thread_call_initialize(void);
101
102void
103thread_call_setup(
104 thread_call_t call,
105 thread_call_func_t func,
106 thread_call_param_t param0
107);
108
109void
110call_thread_block(void),
111call_thread_unblock(void);
112
113#endif /* MACH_KERNEL_PRIVATE */
114
115#ifdef KERNEL_PRIVATE
116
117__BEGIN_DECLS
118
119/*
120 * Obsolete interfaces.
121 */
122
123boolean_t
124thread_call_is_delayed(
125 thread_call_t call,
126 uint64_t *deadline
127);
128
129void
130thread_call_func(
131 thread_call_func_t func,
132 thread_call_param_t param,
133 boolean_t unique_call
134);
135
136void
137thread_call_func_delayed(
138 thread_call_func_t func,
139 thread_call_param_t param,
140 uint64_t deadline
141);
142
143boolean_t
144thread_call_func_cancel(
145 thread_call_func_t func,
146 thread_call_param_t param,
147 boolean_t cancel_all
148);
149
150#ifndef MACH_KERNEL_PRIVATE
151
152#ifndef ABSOLUTETIME_SCALAR_TYPE
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 /* ABSOLUTETIME_SCALAR_TYPE */
167
168#endif /* MACH_KERNEL_PRIVATE */
169
170__END_DECLS
171
172#endif /* KERNEL_PRIVATE */
173
174#endif /* _KERN_THREAD_CALL_H_ */