2 * Copyright (c) 2010-2013 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_INTROSPECTION_INTERNAL__
28 #define __DISPATCH_INTROSPECTION_INTERNAL__
30 #if DISPATCH_INTROSPECTION
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))
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
);
50 DISPATCH_ALWAYS_INLINE
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
;
56 _dispatch_introspection_queue_item_enqueue(dq
, dou
);
57 } while (dou
!= tail
._do
&& (dou
= dou
->do_next
));
60 DISPATCH_ALWAYS_INLINE
62 _dispatch_introspection_queue_push(dispatch_queue_t dq
, dispatch_object_t dou
) {
63 _dispatch_introspection_queue_item_enqueue(dq
, dou
);
66 DISPATCH_ALWAYS_INLINE
68 _dispatch_introspection_queue_pop(dispatch_queue_t dq
, dispatch_object_t dou
) {
69 _dispatch_introspection_queue_item_dequeue(dq
, dou
);
76 #define DISPATCH_INTROSPECTION_QUEUE_LIST
77 #define DISPATCH_INTROSPECTION_QUEUE_LIST_SIZE 0
79 #define _dispatch_introspection_init()
80 #define _dispatch_introspection_thread_add()
81 #define _dispatch_introspection_thread_remove()
83 DISPATCH_ALWAYS_INLINE
84 static inline dispatch_queue_t
85 _dispatch_introspection_queue_create(dispatch_queue_t dq
) { return dq
; }
87 DISPATCH_ALWAYS_INLINE
89 _dispatch_introspection_queue_dispose(dispatch_queue_t dq
) { (void)dq
; }
91 DISPATCH_ALWAYS_INLINE
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
) {}
97 DISPATCH_ALWAYS_INLINE
99 _dispatch_introspection_queue_push(dispatch_queue_t dq DISPATCH_UNUSED
,
100 dispatch_object_t dou DISPATCH_UNUSED
) {}
102 DISPATCH_ALWAYS_INLINE
104 _dispatch_introspection_queue_pop(dispatch_queue_t dq DISPATCH_UNUSED
,
105 dispatch_object_t dou DISPATCH_UNUSED
) {}
107 DISPATCH_ALWAYS_INLINE
109 _dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED
,
110 dispatch_function_t f DISPATCH_UNUSED
) {}
112 DISPATCH_ALWAYS_INLINE
114 _dispatch_introspection_callout_return(void *ctxt DISPATCH_UNUSED
,
115 dispatch_function_t f DISPATCH_UNUSED
) {}
117 #endif // DISPATCH_INTROSPECTION
119 #endif // __DISPATCH_INTROSPECTION_INTERNAL__