]> git.saurik.com Git - apple/libdispatch.git/blob - src/introspection_internal.h
libdispatch-500.1.5.tar.gz
[apple/libdispatch.git] / src / introspection_internal.h
1 /*
2 * Copyright (c) 2010-2013 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_INTROSPECTION_INTERNAL__
28 #define __DISPATCH_INTROSPECTION_INTERNAL__
29
30 #if DISPATCH_INTROSPECTION
31
32 #define DISPATCH_INTROSPECTION_QUEUE_LIST \
33 TAILQ_ENTRY(dispatch_queue_s) diq_list
34 #define DISPATCH_INTROSPECTION_QUEUE_LIST_SIZE \
35 sizeof(TAILQ_ENTRY(dispatch_queue_s))
36
37 void _dispatch_introspection_init(void);
38 void _dispatch_introspection_thread_add(void);
39 dispatch_queue_t _dispatch_introspection_queue_create(dispatch_queue_t dq);
40 void _dispatch_introspection_queue_dispose(dispatch_queue_t dq);
41 void _dispatch_introspection_queue_item_enqueue(dispatch_queue_t dq,
42 dispatch_object_t dou);
43 void _dispatch_introspection_queue_item_dequeue(dispatch_queue_t dq,
44 dispatch_object_t dou);
45 void _dispatch_introspection_queue_item_complete(dispatch_object_t dou);
46 void _dispatch_introspection_callout_entry(void *ctxt, dispatch_function_t f);
47 void _dispatch_introspection_callout_return(void *ctxt, dispatch_function_t f);
48
49 #if !__OBJC2__ && !defined(__cplusplus)
50
51 DISPATCH_ALWAYS_INLINE
52 static inline void
53 _dispatch_introspection_queue_push_list(dispatch_queue_t dq,
54 dispatch_object_t head, dispatch_object_t tail) {
55 struct dispatch_object_s *dou = head._do;
56 do {
57 _dispatch_introspection_queue_item_enqueue(dq, dou);
58 } while (dou != tail._do && (dou = dou->do_next));
59 };
60
61 DISPATCH_ALWAYS_INLINE
62 static inline void
63 _dispatch_introspection_queue_push(dispatch_queue_t dq, dispatch_object_t dou) {
64 _dispatch_introspection_queue_item_enqueue(dq, dou);
65 };
66
67 DISPATCH_ALWAYS_INLINE
68 static inline void
69 _dispatch_introspection_queue_pop(dispatch_queue_t dq, dispatch_object_t dou) {
70 _dispatch_introspection_queue_item_dequeue(dq, dou);
71 };
72
73 #endif // !__OBJC2__ && !defined(__cplusplus)
74
75 #else // DISPATCH_INTROSPECTION
76
77 #define DISPATCH_INTROSPECTION_QUEUE_LIST
78 #define DISPATCH_INTROSPECTION_QUEUE_LIST_SIZE 0
79
80 #define _dispatch_introspection_init()
81 #define _dispatch_introspection_thread_add()
82 #define _dispatch_introspection_thread_remove()
83
84 DISPATCH_ALWAYS_INLINE
85 static inline dispatch_queue_t
86 _dispatch_introspection_queue_create(dispatch_queue_t dq) { return dq; }
87
88 DISPATCH_ALWAYS_INLINE
89 static inline void
90 _dispatch_introspection_queue_dispose(dispatch_queue_t dq) { (void)dq; }
91
92 DISPATCH_ALWAYS_INLINE
93 static inline void
94 _dispatch_introspection_queue_push_list(dispatch_queue_t dq DISPATCH_UNUSED,
95 dispatch_object_t head DISPATCH_UNUSED,
96 dispatch_object_t tail DISPATCH_UNUSED) {}
97
98 DISPATCH_ALWAYS_INLINE
99 static inline void
100 _dispatch_introspection_queue_push(dispatch_queue_t dq DISPATCH_UNUSED,
101 dispatch_object_t dou DISPATCH_UNUSED) {}
102
103 DISPATCH_ALWAYS_INLINE
104 static inline void
105 _dispatch_introspection_queue_pop(dispatch_queue_t dq DISPATCH_UNUSED,
106 dispatch_object_t dou DISPATCH_UNUSED) {}
107
108 DISPATCH_ALWAYS_INLINE
109 static inline void
110 _dispatch_introspection_queue_item_complete(
111 dispatch_object_t dou DISPATCH_UNUSED) {}
112
113 DISPATCH_ALWAYS_INLINE
114 static inline void
115 _dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED,
116 dispatch_function_t f DISPATCH_UNUSED) {}
117
118 DISPATCH_ALWAYS_INLINE
119 static inline void
120 _dispatch_introspection_callout_return(void *ctxt DISPATCH_UNUSED,
121 dispatch_function_t f DISPATCH_UNUSED) {}
122
123 #endif // DISPATCH_INTROSPECTION
124
125 #endif // __DISPATCH_INTROSPECTION_INTERNAL__