]> git.saurik.com Git - apple/xnu.git/blame_incremental - osfmk/kern/thread_call.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / kern / thread_call.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1993-1995, 1999-2000 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * @APPLE_LICENSE_HEADER_START@
6 *
7 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 *
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
18 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
19 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
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
41#include <sys/appleapiopts.h>
42
43#include <mach/mach_types.h>
44
45#include <kern/clock.h>
46
47typedef struct call_entry *thread_call_t;
48typedef void *thread_call_param_t;
49typedef void (*thread_call_func_t)(
50 thread_call_param_t param0,
51 thread_call_param_t param1);
52
53boolean_t
54thread_call_enter(
55 thread_call_t call
56);
57boolean_t
58thread_call_enter1(
59 thread_call_t call,
60 thread_call_param_t param1
61);
62boolean_t
63thread_call_enter_delayed(
64 thread_call_t call,
65 uint64_t deadline
66);
67boolean_t
68thread_call_enter1_delayed(
69 thread_call_t call,
70 thread_call_param_t param1,
71 uint64_t deadline
72);
73boolean_t
74thread_call_cancel(
75 thread_call_t call
76);
77boolean_t
78thread_call_is_delayed(
79 thread_call_t call,
80 uint64_t *deadline
81);
82
83thread_call_t
84thread_call_allocate(
85 thread_call_func_t func,
86 thread_call_param_t param0
87);
88boolean_t
89thread_call_free(
90 thread_call_t call
91);
92
93#ifdef __APPLE_API_PRIVATE
94
95#ifdef __APPLE_API_OBSOLETE
96
97/*
98 * This portion of the interface
99 * is OBSOLETE and DEPRECATED. It
100 * will disappear shortly.
101 */
102
103void
104thread_call_func(
105 thread_call_func_t func,
106 thread_call_param_t param,
107 boolean_t unique_call
108);
109void
110thread_call_func_delayed(
111 thread_call_func_t func,
112 thread_call_param_t param,
113 uint64_t deadline
114);
115
116boolean_t
117thread_call_func_cancel(
118 thread_call_func_t func,
119 thread_call_param_t param,
120 boolean_t cancel_all
121);
122
123/* End OBSOLETE and DEPRECATED */
124
125#endif /* __APPLE_API_OBSOLETE */
126
127#ifdef MACH_KERNEL_PRIVATE
128#include <kern/call_entry.h>
129
130typedef struct call_entry thread_call_data_t;
131
132void
133thread_call_initialize(void);
134
135void
136thread_call_setup(
137 thread_call_t call,
138 thread_call_func_t func,
139 thread_call_param_t param0
140);
141
142void
143call_thread_block(void),
144call_thread_unblock(void);
145
146#endif /* MACH_KERNEL_PRIVATE */
147
148#endif /* __APPLE_API_PRIVATE */
149
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
168#endif /* _KERN_THREAD_CALL_H_ */