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_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
);
51 DISPATCH_ALWAYS_INLINE
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
;
57 _dispatch_introspection_queue_item_enqueue(dq
, dou
);
58 } while (dou
!= tail
._do
&& (dou
= dou
->do_next
));
61 DISPATCH_ALWAYS_INLINE
63 _dispatch_introspection_queue_push(dispatch_queue_t dq
, dispatch_object_t dou
) {
64 _dispatch_introspection_queue_item_enqueue(dq
, dou
);
67 DISPATCH_ALWAYS_INLINE
69 _dispatch_introspection_queue_pop(dispatch_queue_t dq
, dispatch_object_t dou
) {
70 _dispatch_introspection_queue_item_dequeue(dq
, dou
);
77 #define DISPATCH_INTROSPECTION_QUEUE_LIST
78 #define DISPATCH_INTROSPECTION_QUEUE_LIST_SIZE 0
80 #define _dispatch_introspection_init()
81 #define _dispatch_introspection_thread_add()
82 #define _dispatch_introspection_thread_remove()
84 DISPATCH_ALWAYS_INLINE
85 static inline dispatch_queue_t
86 _dispatch_introspection_queue_create(dispatch_queue_t dq
) { return dq
; }
88 DISPATCH_ALWAYS_INLINE
90 _dispatch_introspection_queue_dispose(dispatch_queue_t dq
) { (void)dq
; }
92 DISPATCH_ALWAYS_INLINE
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
) {}
98 DISPATCH_ALWAYS_INLINE
100 _dispatch_introspection_queue_push(dispatch_queue_t dq DISPATCH_UNUSED
,
101 dispatch_object_t dou DISPATCH_UNUSED
) {}
103 DISPATCH_ALWAYS_INLINE
105 _dispatch_introspection_queue_pop(dispatch_queue_t dq DISPATCH_UNUSED
,
106 dispatch_object_t dou DISPATCH_UNUSED
) {}
108 DISPATCH_ALWAYS_INLINE
110 _dispatch_introspection_queue_item_complete(
111 dispatch_object_t dou DISPATCH_UNUSED
) {}
113 DISPATCH_ALWAYS_INLINE
115 _dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED
,
116 dispatch_function_t f DISPATCH_UNUSED
) {}
118 DISPATCH_ALWAYS_INLINE
120 _dispatch_introspection_callout_return(void *ctxt DISPATCH_UNUSED
,
121 dispatch_function_t f DISPATCH_UNUSED
) {}
123 #endif // DISPATCH_INTROSPECTION
125 #endif // __DISPATCH_INTROSPECTION_INTERNAL__