Tizen 2.1 base
[platform/upstream/gcd.git] / dispatch-1.0 / 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 #if HAVE_MACH
31 #include <mach/boolean.h>
32 #include <mach/mach.h>
33 #include <mach/message.h>
34 #endif
35 #if HAVE_UNISTD_H
36 #include <unistd.h>
37 #endif
38 #if HAVE_SYS_CDEFS_H
39 #include <sys/cdefs.h>
40 #endif
41 #include <pthread.h>
42
43 #ifndef __DISPATCH_BUILDING_DISPATCH__
44 #include_next <dispatch/dispatch.h>
45
46 // Workaround <rdar://problem/6597365/>
47 #ifndef __DISPATCH_PUBLIC__
48 #include "/usr/include/dispatch/dispatch.h"
49 #endif
50
51 #ifndef __DISPATCH_INDIRECT__
52 #define __DISPATCH_INDIRECT__
53 #endif
54
55 #include <dispatch/benchmark.h>
56 #include <dispatch/queue_private.h>
57 #include <dispatch/source_private.h>
58
59 #ifndef DISPATCH_NO_LEGACY
60 #include <dispatch/legacy.h>
61 #endif
62
63 #undef __DISPATCH_INDIRECT__
64
65 #endif /* !__DISPATCH_BUILDING_DISPATCH__ */
66
67 /* LEGACY: Use DISPATCH_API_VERSION */
68 #define LIBDISPATCH_VERSION DISPATCH_API_VERSION
69
70 __DISPATCH_BEGIN_DECLS
71
72 DISPATCH_NOTHROW
73 void
74 #if USE_LIBDISPATCH_INIT_CONSTRUCTOR
75 libdispatch_init(void) __attribute__ ((constructor));
76 #else
77 libdispatch_init(void);
78 #endif
79
80 #if HAVE_MACH
81 #define DISPATCH_COCOA_COMPAT 1
82 #if DISPATCH_COCOA_COMPAT
83
84 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
85 DISPATCH_NOTHROW
86 mach_port_t
87 _dispatch_get_main_queue_port_4CF(void);
88
89 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
90 DISPATCH_NOTHROW
91 void
92 _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
93
94 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
95 extern void (*dispatch_begin_thread_4GC)(void);
96
97 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
98 extern void (*dispatch_end_thread_4GC)(void);
99
100 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
101 extern void *(*_dispatch_begin_NSAutoReleasePool)(void);
102
103 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
104 extern void (*_dispatch_end_NSAutoReleasePool)(void *);
105
106 #endif
107 #endif /* HAVE_MACH */
108
109 /* pthreads magic */
110
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);
115
116 #if HAVE_MACH
117 /*
118  * Extract the context pointer from a mach message trailer.
119  */
120 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
121 void *
122 dispatch_mach_msg_get_context(mach_msg_header_t *msg);
123 #endif
124
125 __DISPATCH_END_DECLS
126
127 #endif