]> git.saurik.com Git - apple/libdispatch.git/blob - src/private.h
libdispatch-84.5.1.tar.gz
[apple/libdispatch.git] / src / private.h
1 /*
2 * Copyright (c) 2008-2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
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
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
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.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20
21 /*
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.
25 */
26
27 #ifndef __DISPATCH_PRIVATE__
28 #define __DISPATCH_PRIVATE__
29
30 #include <mach/boolean.h>
31 #include <mach/mach.h>
32 #include <mach/message.h>
33 #include <unistd.h>
34 #include <sys/cdefs.h>
35 #include <sys/event.h>
36 #include <pthread.h>
37
38 #ifndef __DISPATCH_BUILDING_DISPATCH__
39 #include_next <dispatch/dispatch.h>
40
41 // Workaround <rdar://problem/6597365/>
42 #ifndef __DISPATCH_PUBLIC__
43 #include "/usr/include/dispatch/dispatch.h"
44 #endif
45
46 #ifndef __DISPATCH_INDIRECT__
47 #define __DISPATCH_INDIRECT__
48 #endif
49
50 #include <dispatch/benchmark.h>
51 #include <dispatch/queue_private.h>
52 #include <dispatch/source_private.h>
53
54 #ifndef DISPATCH_NO_LEGACY
55 #include <dispatch/legacy.h>
56 #endif
57
58 #undef __DISPATCH_INDIRECT__
59
60 #endif /* !__DISPATCH_BUILDING_DISPATCH__ */
61
62 /* LEGACY: Use DISPATCH_API_VERSION */
63 #define LIBDISPATCH_VERSION DISPATCH_API_VERSION
64
65 __BEGIN_DECLS
66
67 DISPATCH_NOTHROW
68 void
69 libdispatch_init(void);
70
71 #define DISPATCH_COCOA_COMPAT 1
72 #if DISPATCH_COCOA_COMPAT
73
74 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
75 DISPATCH_NOTHROW
76 mach_port_t
77 _dispatch_get_main_queue_port_4CF(void);
78
79 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
80 DISPATCH_NOTHROW
81 void
82 _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
83
84 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
85 extern void (*dispatch_begin_thread_4GC)(void);
86
87 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
88 extern void (*dispatch_end_thread_4GC)(void);
89
90 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
91 extern void *(*_dispatch_begin_NSAutoReleasePool)(void);
92
93 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
94 extern void (*_dispatch_end_NSAutoReleasePool)(void *);
95
96 #endif
97
98 /* pthreads magic */
99
100 DISPATCH_NOTHROW void dispatch_atfork_prepare(void);
101 DISPATCH_NOTHROW void dispatch_atfork_parent(void);
102 DISPATCH_NOTHROW void dispatch_atfork_child(void);
103 DISPATCH_NOTHROW void dispatch_init_pthread(pthread_t);
104
105 /*
106 * Extract the context pointer from a mach message trailer.
107 */
108 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
109 void *
110 dispatch_mach_msg_get_context(mach_msg_header_t *msg);
111
112 __END_DECLS
113
114 #endif