2 * Copyright (c) 2008-2011 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
22 * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch
23 * which are subject to change in future releases of Mac OS X. Any applications
24 * relying on these interfaces WILL break.
27 #ifndef __DISPATCH_PRIVATE__
28 #define __DISPATCH_PRIVATE__
31 #include <TargetConditionals.h>
35 #include <mach/boolean.h>
36 #include <mach/mach.h>
37 #include <mach/message.h>
43 #include <sys/cdefs.h>
47 #ifndef __DISPATCH_BUILDING_DISPATCH__
48 #include <dispatch/dispatch.h>
50 #ifndef __DISPATCH_INDIRECT__
51 #define __DISPATCH_INDIRECT__
54 #include <dispatch/benchmark.h>
55 #include <dispatch/queue_private.h>
56 #include <dispatch/source_private.h>
57 #include <dispatch/data_private.h>
59 #undef __DISPATCH_INDIRECT__
61 #endif /* !__DISPATCH_BUILDING_DISPATCH__ */
63 // <rdar://problem/9627726> Check that public and private dispatch headers match
64 #if DISPATCH_API_VERSION != 20111201 // Keep in sync with <dispatch/dispatch.h>
65 #error "Dispatch header mismatch between /usr/include and /usr/local/include"
70 DISPATCH_EXPORT DISPATCH_NOTHROW
72 libdispatch_init(void);
75 #define DISPATCH_COCOA_COMPAT 1
76 #if DISPATCH_COCOA_COMPAT
78 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
79 DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW
81 _dispatch_get_main_queue_port_4CF(void);
83 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
84 DISPATCH_EXPORT DISPATCH_NOTHROW
86 _dispatch_main_queue_callback_4CF(mach_msg_header_t
*msg
);
88 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
90 void (*dispatch_begin_thread_4GC
)(void);
92 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
94 void (*dispatch_end_thread_4GC
)(void);
96 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
98 void (*dispatch_no_worker_threads_4GC
)(void);
100 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
102 void *(*_dispatch_begin_NSAutoReleasePool
)(void);
104 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
106 void (*_dispatch_end_NSAutoReleasePool
)(void *);
108 __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_6_0
)
109 DISPATCH_EXPORT DISPATCH_NOTHROW
110 bool _dispatch_is_multithreaded(void);
112 #define _dispatch_time_after_nsec(t) \
113 dispatch_time(DISPATCH_TIME_NOW, (t))
114 #define _dispatch_time_after_usec(t) \
115 dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_USEC)
116 #define _dispatch_time_after_msec(t) \
117 dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_MSEC)
118 #define _dispatch_time_after_sec(t) \
119 dispatch_time(DISPATCH_TIME_NOW, (t) * NSEC_PER_SEC)
122 #endif /* TARGET_OS_MAC */
126 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_prepare(void);
127 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_parent(void);
128 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_child(void);
132 * Extract the context pointer from a mach message trailer.
134 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
135 DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NONNULL_ALL
138 dispatch_mach_msg_get_context(mach_msg_header_t
*msg
);
139 #endif /* TARGET_OS_MAC */