2 * Copyright (c) 2008-2009 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 <mach/boolean.h>
32 #include <mach/mach.h>
33 #include <mach/message.h>
39 #include <sys/cdefs.h>
43 #ifndef __DISPATCH_BUILDING_DISPATCH__
44 #include_next <dispatch/dispatch.h>
46 // Workaround <rdar://problem/6597365/>
47 #ifndef __DISPATCH_PUBLIC__
48 #include "/usr/include/dispatch/dispatch.h"
51 #ifndef __DISPATCH_INDIRECT__
52 #define __DISPATCH_INDIRECT__
55 #include <dispatch/benchmark.h>
56 #include <dispatch/queue_private.h>
57 #include <dispatch/source_private.h>
59 #ifndef DISPATCH_NO_LEGACY
60 #include <dispatch/legacy.h>
63 #undef __DISPATCH_INDIRECT__
65 #endif /* !__DISPATCH_BUILDING_DISPATCH__ */
67 /* LEGACY: Use DISPATCH_API_VERSION */
68 #define LIBDISPATCH_VERSION DISPATCH_API_VERSION
70 __DISPATCH_BEGIN_DECLS
74 #if USE_LIBDISPATCH_INIT_CONSTRUCTOR
75 libdispatch_init(void) __attribute__ ((constructor));
77 libdispatch_init(void);
81 #define DISPATCH_COCOA_COMPAT 1
82 #if DISPATCH_COCOA_COMPAT
84 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
87 _dispatch_get_main_queue_port_4CF(void);
89 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
92 _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
94 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
95 extern void (*dispatch_begin_thread_4GC)(void);
97 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
98 extern void (*dispatch_end_thread_4GC)(void);
100 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
101 extern void *(*_dispatch_begin_NSAutoReleasePool)(void);
103 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
104 extern void (*_dispatch_end_NSAutoReleasePool)(void *);
107 #endif /* HAVE_MACH */
111 DISPATCH_NOTHROW void dispatch_atfork_prepare(void);
112 DISPATCH_NOTHROW void dispatch_atfork_parent(void);
113 DISPATCH_NOTHROW void dispatch_atfork_child(void);
114 DISPATCH_NOTHROW void dispatch_init_pthread(pthread_t);
118 * Extract the context pointer from a mach message trailer.
120 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
122 dispatch_mach_msg_get_context(mach_msg_header_t *msg);