]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/thread_call.h
xnu-344.tar.gz
[apple/xnu.git] / osfmk / kern / thread_call.h
CommitLineData
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
9bccf70c
A
38#include <sys/appleapiopts.h>
39
1c79356b
A
40#include <mach/mach_types.h>
41
0b4e3aa0
A
42#include <kern/clock.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);
49
50boolean_t
51thread_call_enter(
52 thread_call_t call
53);
54boolean_t
55thread_call_enter1(
56 thread_call_t call,
57 thread_call_param_t param1
58);
59boolean_t
60thread_call_enter_delayed(
61 thread_call_t call,
0b4e3aa0 62 uint64_t deadline
1c79356b
A
63);
64boolean_t
65thread_call_enter1_delayed(
66 thread_call_t call,
67 thread_call_param_t param1,
0b4e3aa0 68 uint64_t deadline
1c79356b
A
69);
70boolean_t
71thread_call_cancel(
72 thread_call_t call
73);
74boolean_t
75thread_call_is_delayed(
76 thread_call_t call,
0b4e3aa0 77 uint64_t *deadline
1c79356b
A
78);
79
80thread_call_t
81thread_call_allocate(
82 thread_call_func_t func,
83 thread_call_param_t param0
84);
85boolean_t
86thread_call_free(
87 thread_call_t call
88);
89
9bccf70c
A
90#ifdef __APPLE_API_PRIVATE
91
92#ifdef __APPLE_API_OBSOLETE
93
1c79356b
A
94/*
95 * This portion of the interface
96 * is OBSOLETE and DEPRECATED. It
97 * will disappear shortly.
98 */
9bccf70c 99
1c79356b
A
100void
101thread_call_func(
102 thread_call_func_t func,
103 thread_call_param_t param,
104 boolean_t unique_call
105);
106void
107thread_call_func_delayed(
108 thread_call_func_t func,
109 thread_call_param_t param,
0b4e3aa0 110 uint64_t deadline
1c79356b
A
111);
112
113boolean_t
114thread_call_func_cancel(
115 thread_call_func_t func,
116 thread_call_param_t param,
117 boolean_t cancel_all
118);
9bccf70c 119
1c79356b
A
120/* End OBSOLETE and DEPRECATED */
121
9bccf70c
A
122#endif /* __APPLE_API_OBSOLETE */
123
1c79356b
A
124#ifdef MACH_KERNEL_PRIVATE
125#include <kern/call_entry.h>
126
127typedef struct call_entry thread_call_data_t;
128
129void
130thread_call_initialize(void);
131
132void
133thread_call_setup(
134 thread_call_t call,
135 thread_call_func_t func,
136 thread_call_param_t param0
137);
138
9bccf70c
A
139void
140call_thread_block(void),
141call_thread_unblock(void);
142
1c79356b
A
143#endif /* MACH_KERNEL_PRIVATE */
144
9bccf70c
A
145#endif /* __APPLE_API_PRIVATE */
146
0b4e3aa0
A
147#if !defined(MACH_KERNEL_PRIVATE) && !defined(ABSOLUTETIME_SCALAR_TYPE)
148
149#include <libkern/OSBase.h>
150
151#define thread_call_enter_delayed(a, b) \
152 thread_call_enter_delayed((a), __OSAbsoluteTime(b))
153
154#define thread_call_enter1_delayed(a, b, c) \
155 thread_call_enter1_delayed((a), (b), __OSAbsoluteTime(c))
156
157#define thread_call_is_delayed(a, b) \
158 thread_call_is_delayed((a), __OSAbsoluteTimePtr(b))
159
160#define thread_call_func_delayed(a, b, c) \
161 thread_call_func_delayed((a), (b), __OSAbsoluteTime(c))
162
163#endif
164
1c79356b 165#endif /* _KERN_THREAD_CALL_H_ */