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