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 37void _dispatch_introspection_init(void); 38void _dispatch_introspection_thread_add(void); 39dispatch_queue_t _dispatch_introspection_queue_create(dispatch_queue_t dq); 40void _dispatch_introspection_queue_dispose(dispatch_queue_t dq); 41void _dispatch_introspection_queue_item_enqueue(dispatch_queue_t dq, 42 dispatch_object_t dou); 43void _dispatch_introspection_queue_item_dequeue(dispatch_queue_t dq, 44 dispatch_object_t dou); 45void _dispatch_introspection_queue_item_complete(dispatch_object_t dou); 46void _dispatch_introspection_callout_entry(void *ctxt, dispatch_function_t f); 47void _dispatch_introspection_callout_return(void *ctxt, dispatch_function_t f); 48 49#if !__OBJC2__ 50 51DISPATCH_ALWAYS_INLINE 52static 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 61DISPATCH_ALWAYS_INLINE 62static 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 67DISPATCH_ALWAYS_INLINE 68static 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 74 75#else 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 84DISPATCH_ALWAYS_INLINE 85static inline dispatch_queue_t 86_dispatch_introspection_queue_create(dispatch_queue_t dq) { return dq; } 87 88DISPATCH_ALWAYS_INLINE 89static inline void 90_dispatch_introspection_queue_dispose(dispatch_queue_t dq) { (void)dq; } 91 92DISPATCH_ALWAYS_INLINE 93static 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 98DISPATCH_ALWAYS_INLINE 99static inline void 100_dispatch_introspection_queue_push(dispatch_queue_t dq DISPATCH_UNUSED, 101 dispatch_object_t dou DISPATCH_UNUSED) {} 102 103DISPATCH_ALWAYS_INLINE 104static inline void 105_dispatch_introspection_queue_pop(dispatch_queue_t dq DISPATCH_UNUSED, 106 dispatch_object_t dou DISPATCH_UNUSED) {} 107 108DISPATCH_ALWAYS_INLINE 109static inline void 110_dispatch_introspection_queue_item_complete( 111 dispatch_object_t dou DISPATCH_UNUSED) {} 112 113DISPATCH_ALWAYS_INLINE 114static inline void 115_dispatch_introspection_callout_entry(void *ctxt DISPATCH_UNUSED, 116 dispatch_function_t f DISPATCH_UNUSED) {} 117 118DISPATCH_ALWAYS_INLINE 119static 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__ 126