]> git.saurik.com Git - apple/libdispatch.git/blob - src/introspection_internal.h
89a9360c01363076028c1b602149933e9d5ecaad
[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_callout_entry(void *ctxt, dispatch_function_t f);
46 void _dispatch_introspection_callout_return(void *ctxt, dispatch_function_t f);
47
48 #if !__OBJC2__
49
50 DISPATCH_ALWAYS_INLINE
51 static inline void
52 _dispatch_introspection_queue_push_list(dispatch_queue_t dq,
53 dispatch_object_t head, dispatch_object_t tail) {
54 struct dispatch_object_s *dou = head._do;
55 do {
56 _dispatch_introspection_queue_item_enqueue(dq, dou);
57 } while (dou != tail._do && (dou = dou->do_next));
58 };
59
60 DISPATCH_ALWAYS_INLINE
61 static inline void
62 _dispatch_introspection_queue_push(dispatch_queue_t dq, dispatch_object_t dou) {
63 _dispatch_introspection_queue_item_enqueue(dq, dou);
64 };
65
66 DISPATCH_ALWAYS_INLINE
67 static inline void
68 _dispatch_introspection_queue_pop(dispatch_queue_t dq, dispatch_object_t dou) {
69 _dispatch_introspection_queue_item_dequeue(dq, dou);
70 };
71
72 #endif
73
74 #else
75
76 #define DISPATCH_INTROSPECTION_QUEUE_LIST
77 #define DISPATCH_INTROSPECTION_QUEUE_LIST_SIZE 0
78
79 #define _dispatch_introspection_init()
80 #define _dispatch_introspection_thread_add()
81 #define _dispatch_introspection_thread_remove()
82
83 DISPATCH_ALWAYS_INLINE
84 static inline dispatch_queue_t
85 _dispatch_introspection_queue_create(dispatch_queue_t dq) { return dq; }
86
87 DISPATCH_ALWAYS_INLINE
88 static inline void
89 _dispatch_introspection_queue_dispose(dispatch_queue_t dq) { (void)dq; }
90
91 DISPATCH_ALWAYS_INLINE
92 static inline void
93 _dispatch_introspection_queue_push_list(dispatch_queue_t dq DISPATCH_UNUSED,
94 dispatch_object_t head DISPATCH_UNUSED,
95 dispatch_object_t tail DISPATCH_UNUSED) {}
96
97 DISPATCH_ALWAYS_INLINE
98 static inline void
99 _dispatch_introspection_queue_push(dispatch_queue_t dq DISPATCH_UNUSED,
100 dispatch_object_t dou DISPATCH_UNUSED) {}
101
102 DISPATCH_ALWAYS_INLINE
103 static inline void
104 _dispatch_introspection_queue_pop(dispatch_queue_t dq DISPATCH_UNUSED,
105 dispatch_object_t dou DISPATCH_UNUSED) {}
106
107 DISPATCH_ALWAYS_INLINE
108 static inline void
109 _dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED,
110 dispatch_function_t f DISPATCH_UNUSED) {}
111
112 DISPATCH_ALWAYS_INLINE
113 static inline void
114 _dispatch_introspection_callout_return(void *ctxt DISPATCH_UNUSED,
115 dispatch_function_t f DISPATCH_UNUSED) {}
116
117 #endif // DISPATCH_INTROSPECTION
118
119 #endif // __DISPATCH_INTROSPECTION_INTERNAL__