]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/thread_call.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / kern / thread_call.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 1993-1995, 1999-2005 Apple Computer, Inc.
1c79356b
A
3 * All rights reserved.
4 *
8ad349bb 5 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 6 *
8ad349bb
A
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@
1c79356b
A
30 */
31/*
32 * Declarations for thread-based callouts.
1c79356b
A
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
91447636
A
42#include <sys/cdefs.h>
43
1c79356b
A
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);
91447636 49__BEGIN_DECLS
1c79356b
A
50
51boolean_t
52thread_call_enter(
53 thread_call_t call
54);
91447636 55
1c79356b
A
56boolean_t
57thread_call_enter1(
58 thread_call_t call,
59 thread_call_param_t param1
60);
91447636 61
1c79356b
A
62boolean_t
63thread_call_enter_delayed(
64 thread_call_t call,
0b4e3aa0 65 uint64_t deadline
1c79356b 66);
91447636 67
1c79356b
A
68boolean_t
69thread_call_enter1_delayed(
70 thread_call_t call,
71 thread_call_param_t param1,
0b4e3aa0 72 uint64_t deadline
1c79356b 73);
91447636 74
1c79356b
A
75boolean_t
76thread_call_cancel(
77 thread_call_t call
78);
1c79356b
A
79
80thread_call_t
81thread_call_allocate(
82 thread_call_func_t func,
83 thread_call_param_t param0
84);
91447636 85
1c79356b
A
86boolean_t
87thread_call_free(
88 thread_call_t call
89);
90
91447636
A
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
9bccf70c 116
91447636 117__BEGIN_DECLS
9bccf70c 118
1c79356b 119/*
91447636 120 * Obsolete interfaces.
1c79356b 121 */
9bccf70c 122
91447636
A
123boolean_t
124thread_call_is_delayed(
125 thread_call_t call,
126 uint64_t *deadline
127);
128
1c79356b
A
129void
130thread_call_func(
131 thread_call_func_t func,
132 thread_call_param_t param,
133 boolean_t unique_call
134);
91447636 135
1c79356b
A
136void
137thread_call_func_delayed(
138 thread_call_func_t func,
139 thread_call_param_t param,
0b4e3aa0 140 uint64_t deadline
1c79356b
A
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);
9bccf70c 149
91447636 150#ifndef MACH_KERNEL_PRIVATE
9bccf70c 151
91447636 152#ifndef ABSOLUTETIME_SCALAR_TYPE
0b4e3aa0
A
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
91447636
A
166#endif /* ABSOLUTETIME_SCALAR_TYPE */
167
168#endif /* MACH_KERNEL_PRIVATE */
169
170__END_DECLS
171
172#endif /* KERNEL_PRIVATE */
0b4e3aa0 173
91447636 174#endif /* _KERN_THREAD_CALL_H_ */