2 * Copyright (c) 2008-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_INTERNAL__
28 #define __DISPATCH_INTERNAL__
30 #include <config/config.h>
32 #define __DISPATCH_BUILDING_DISPATCH__
33 #define __DISPATCH_INDIRECT__
36 #include <Availability.h>
37 #include <TargetConditionals.h>
41 #if !defined(DISPATCH_MACH_SPI) && TARGET_OS_MAC
42 #define DISPATCH_MACH_SPI 1
45 #if !defined(USE_OBJC) && HAVE_OBJC
49 #if USE_OBJC && ((!TARGET_IPHONE_SIMULATOR && defined(__i386__)) || \
50 (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 1080))
51 // Disable Objective-C support on platforms with legacy objc runtime
57 #define OS_OBJECT_HAVE_OBJC_SUPPORT 1
59 #define OS_OBJECT_USE_OBJC 1
61 #define OS_OBJECT_USE_OBJC 0
64 #define OS_OBJECT_HAVE_OBJC_SUPPORT 0
67 #include <dispatch/dispatch.h>
68 #include <dispatch/base.h>
71 #include <os/object.h>
72 #include <dispatch/object.h>
73 #include <dispatch/time.h>
74 #include <dispatch/queue.h>
75 #include <dispatch/source.h>
76 #include <dispatch/group.h>
77 #include <dispatch/semaphore.h>
78 #include <dispatch/once.h>
79 #include <dispatch/data.h>
81 #include <dispatch/io.h>
84 #define DISPATCH_STRUCT_DECL(type, name, ...) \
85 struct type __VA_ARGS__ name
87 // Visual Studio C++ does not support C99 designated initializers.
88 // This means that static declarations should be zero initialized and cannot
89 // be const since we must fill in the values during DLL initialization.
91 #define DISPATCH_STRUCT_INSTANCE(type, name, ...) \
92 struct type name = { \
96 #define DISPATCH_STRUCT_INSTANCE(type, name, ...) \
97 struct type name = { 0 }
101 #define DISPATCH_CONST_STRUCT_DECL(type, name, ...) \
102 const DISPATCH_STRUCT_DECL(type, name, __VA_ARGS__)
104 #define DISPATCH_CONST_STRUCT_INSTANCE(type, name, ...) \
105 const DISPATCH_STRUCT_INSTANCE(type, name, __VA_ARGS__)
107 #define DISPATCH_CONST_STRUCT_DECL(type, name, ...) \
108 DISPATCH_STRUCT_DECL(type, name, __VA_ARGS__)
110 #define DISPATCH_CONST_STRUCT_INSTANCE(type, name, ...) \
111 DISPATCH_STRUCT_INSTANCE(type, name, __VA_ARGS__)
114 /* private.h must be included last to avoid picking up installed headers. */
115 #include "object_private.h"
116 #include "queue_private.h"
117 #include "source_private.h"
118 #include "mach_private.h"
119 #include "data_private.h"
121 #include "io_private.h"
123 #include "benchmark.h"
126 /* SPI for Libsystem-internal use */
127 DISPATCH_EXPORT DISPATCH_NOTHROW
void libdispatch_init(void);
129 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_prepare(void);
130 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_parent(void);
131 DISPATCH_EXPORT DISPATCH_NOTHROW
void dispatch_atfork_child(void);
134 /* More #includes at EOF (dependent on the contents of internal.h) ... */
136 // Abort on uncaught exceptions thrown from client callouts rdar://8577499
137 #if !defined(DISPATCH_USE_CLIENT_CALLOUT)
138 #define DISPATCH_USE_CLIENT_CALLOUT 1
141 /* The "_debug" library build */
142 #ifndef DISPATCH_DEBUG
143 #define DISPATCH_DEBUG 0
146 #ifndef DISPATCH_PROFILE
147 #define DISPATCH_PROFILE 0
150 #if (!TARGET_OS_EMBEDDED || DISPATCH_DEBUG || DISPATCH_PROFILE) && \
151 !defined(DISPATCH_USE_DTRACE)
152 #define DISPATCH_USE_DTRACE 1
155 #if ((!TARGET_OS_EMBEDDED && DISPATCH_INTROSPECTION) || DISPATCH_DEBUG || \
156 DISPATCH_PROFILE) && !defined(DISPATCH_USE_DTRACE_INTROSPECTION)
157 #define DISPATCH_USE_DTRACE_INTROSPECTION 1
160 #if HAVE_LIBKERN_OSCROSSENDIAN_H
161 #include <libkern/OSCrossEndian.h>
163 #if HAVE_LIBKERN_OSATOMIC_H
164 #include <libkern/OSAtomic.h>
167 #include <mach/boolean.h>
168 #include <mach/clock_types.h>
169 #include <mach/clock.h>
170 #include <mach/exception.h>
171 #include <mach/mach.h>
172 #include <mach/mach_error.h>
173 #include <mach/mach_host.h>
174 #include <mach/mach_interface.h>
175 #include <mach/mach_time.h>
176 #include <mach/mach_traps.h>
177 #include <mach/message.h>
178 #include <mach/mig_errors.h>
179 #include <mach/host_info.h>
180 #include <mach/notify.h>
181 #include <mach/mach_vm.h>
182 #include <mach/vm_map.h>
183 #endif /* HAVE_MACH */
184 #if HAVE_MALLOC_MALLOC_H
185 #include <malloc/malloc.h>
188 #include <sys/stat.h>
191 #include <sys/event.h>
192 #include <sys/mount.h>
193 #include <sys/queue.h>
194 #include <sys/sysctl.h>
195 #include <sys/socket.h>
196 #include <sys/time.h>
197 #include <sys/mman.h>
198 #include <netinet/in.h>
200 #include "sys_queue.h"
204 #include <Block_private.h>
206 #endif /* __BLOCKS__ */
216 #include <semaphore.h>
232 #ifndef __has_builtin
233 #define __has_builtin(x) 0
235 #ifndef __has_include
236 #define __has_include(x) 0
238 #ifndef __has_feature
239 #define __has_feature(x) 0
241 #ifndef __has_attribute
242 #define __has_attribute(x) 0
246 #define DISPATCH_NOINLINE __attribute__((__noinline__))
247 #define DISPATCH_USED __attribute__((__used__))
248 #define DISPATCH_UNUSED __attribute__((__unused__))
249 #define DISPATCH_WEAK __attribute__((__weak__))
250 #define DISPATCH_OVERLOADABLE __attribute__((__overloadable__))
252 #define DISPATCH_ALWAYS_INLINE_NDEBUG
254 #define DISPATCH_ALWAYS_INLINE_NDEBUG __attribute__((__always_inline__))
257 #define DISPATCH_NOINLINE
258 #define DISPATCH_USED
259 #define DISPATCH_UNUSED
260 #define DISPATCH_WEAK
261 #define DISPATCH_ALWAYS_INLINE_NDEBUG
262 #endif /* __GNUC__ */
264 #define DISPATCH_CONCAT(x,y) DISPATCH_CONCAT1(x,y)
265 #define DISPATCH_CONCAT1(x,y) x ## y
267 // workaround 6368156
277 #define NSEC_PER_SEC 1000000000ull
278 #define USEC_PER_SEC 1000000ull
279 #define NSEC_PER_USEC 1000ull
281 /* I wish we had __builtin_expect_range() */
283 #define fastpath(x) ((typeof(x))__builtin_expect((long)(x), ~0l))
284 #define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l))
286 #define fastpath(x) (x)
287 #define slowpath(x) (x)
291 void _dispatch_bug(size_t line
, long val
);
295 void _dispatch_bug_client(const char* msg
);
297 void _dispatch_bug_mach_client(const char *msg
, mach_msg_return_t kr
);
299 void _dispatch_bug_kevent_client(const char* msg
, const char* filter
,
300 const char *operation
, int err
);
303 DISPATCH_NOINLINE DISPATCH_NORETURN
304 void _dispatch_abort(size_t line
, long val
);
306 #if !defined(DISPATCH_USE_OS_TRACE) && DISPATCH_DEBUG
307 #if __has_include(<os/trace.h>)
308 #define DISPATCH_USE_OS_TRACE 1
309 #include <os/trace.h>
311 #endif // DISPATCH_USE_OS_TRACE
313 #if DISPATCH_USE_OS_TRACE
314 #define _dispatch_log(msg, ...) os_trace("libdispatch", msg, ## __VA_ARGS__)
316 DISPATCH_NOINLINE
__attribute__((__format__(__printf__
,1,2)))
317 void _dispatch_log(const char *msg
, ...);
318 #endif // DISPATCH_USE_OS_TRACE
320 #define dsnprintf(...) \
321 ({ int _r = snprintf(__VA_ARGS__); _r < 0 ? 0u : (size_t)_r; })
324 * For reporting bugs within libdispatch when using the "_debug" version of the
328 #define dispatch_assert(e) do { \
329 if (__builtin_constant_p(e)) { \
330 char __compile_time_assert__[(bool)(e) ? 1 : -1] DISPATCH_UNUSED; \
332 typeof(e) _e = fastpath(e); /* always eval 'e' */ \
333 if (DISPATCH_DEBUG && !_e) { \
334 _dispatch_abort(__LINE__, (long)_e); \
339 static inline void _dispatch_assert(long e
, long line
) {
340 if (DISPATCH_DEBUG
&& !e
) _dispatch_abort(line
, e
);
342 #define dispatch_assert(e) _dispatch_assert((long)(e), __LINE__)
343 #endif /* __GNUC__ */
347 * A lot of API return zero upon success and not-zero on fail. Let's capture
348 * and log the non-zero value
350 #define dispatch_assert_zero(e) do { \
351 if (__builtin_constant_p(e)) { \
352 char __compile_time_assert__[(bool)(e) ? -1 : 1] DISPATCH_UNUSED; \
354 typeof(e) _e = slowpath(e); /* always eval 'e' */ \
355 if (DISPATCH_DEBUG && _e) { \
356 _dispatch_abort(__LINE__, (long)_e); \
361 static inline void _dispatch_assert_zero(long e
, long line
) {
362 if (DISPATCH_DEBUG
&& e
) _dispatch_abort(line
, e
);
364 #define dispatch_assert_zero(e) _dispatch_assert((long)(e), __LINE__)
365 #endif /* __GNUC__ */
368 * For reporting bugs or impedance mismatches between libdispatch and external
369 * subsystems. These do NOT abort(), and are always compiled into the product.
371 * In particular, we wrap all system-calls with assume() macros.
374 #define dispatch_assume(e) ({ \
375 typeof(e) _e = fastpath(e); /* always eval 'e' */ \
377 if (__builtin_constant_p(e)) { \
378 char __compile_time_assert__[(bool)(e) ? 1 : -1]; \
379 (void)__compile_time_assert__; \
381 _dispatch_bug(__LINE__, (long)_e); \
386 static inline long _dispatch_assume(long e
, long line
) {
387 if (!e
) _dispatch_bug(line
, e
);
390 #define dispatch_assume(e) _dispatch_assume((long)(e), __LINE__)
391 #endif /* __GNUC__ */
394 * A lot of API return zero upon success and not-zero on fail. Let's capture
395 * and log the non-zero value
398 #define dispatch_assume_zero(e) ({ \
399 typeof(e) _e = slowpath(e); /* always eval 'e' */ \
401 if (__builtin_constant_p(e)) { \
402 char __compile_time_assert__[(bool)(e) ? -1 : 1]; \
403 (void)__compile_time_assert__; \
405 _dispatch_bug(__LINE__, (long)_e); \
410 static inline long _dispatch_assume_zero(long e
, long line
) {
411 if (e
) _dispatch_bug(line
, e
);
414 #define dispatch_assume_zero(e) _dispatch_assume_zero((long)(e), __LINE__)
415 #endif /* __GNUC__ */
418 * For reporting bugs in clients when using the "_debug" version of the library.
421 #define dispatch_debug_assert(e, msg, args...) do { \
422 if (__builtin_constant_p(e)) { \
423 char __compile_time_assert__[(bool)(e) ? 1 : -1] DISPATCH_UNUSED; \
425 typeof(e) _e = fastpath(e); /* always eval 'e' */ \
426 if (DISPATCH_DEBUG && !_e) { \
427 _dispatch_log("%s() 0x%lx: " msg, __func__, (long)_e, ##args); \
433 #define dispatch_debug_assert(e, msg, args...) do { \
434 long _e = (long)fastpath(e); /* always eval 'e' */ \
435 if (DISPATCH_DEBUG && !_e) { \
436 _dispatch_log("%s() 0x%lx: " msg, __FUNCTION__, _e, ##args); \
440 #endif /* __GNUC__ */
442 /* Make sure the debug statments don't get too stale */
443 #define _dispatch_debug(x, args...) do { \
444 if (DISPATCH_DEBUG) { \
445 _dispatch_log("%u\t%p\t" x, __LINE__, \
446 (void *)_dispatch_thread_self(), ##args); \
452 DISPATCH_NOINLINE DISPATCH_USED
453 void dispatch_debug_machport(mach_port_t name
, const char* str
);
458 /* This is the private version of the deprecated dispatch_debug() */
459 DISPATCH_NONNULL2 DISPATCH_NOTHROW
460 __attribute__((__format__(printf
,2,3)))
462 _dispatch_object_debug(dispatch_object_t object
, const char *message
, ...);
464 #define _dispatch_object_debug(object, message, ...)
465 #endif // DISPATCH_DEBUG
467 #if DISPATCH_USE_CLIENT_CALLOUT
469 DISPATCH_NOTHROW
void
470 _dispatch_client_callout(void *ctxt
, dispatch_function_t f
);
471 DISPATCH_NOTHROW
void
472 _dispatch_client_callout2(void *ctxt
, size_t i
, void (*f
)(void *, size_t));
473 DISPATCH_NOTHROW
bool
474 _dispatch_client_callout3(void *ctxt
, dispatch_data_t region
, size_t offset
,
475 const void *buffer
, size_t size
, dispatch_data_applier_function_t f
);
476 DISPATCH_NOTHROW
void
477 _dispatch_client_callout4(void *ctxt
, dispatch_mach_reason_t reason
,
478 dispatch_mach_msg_t dmsg
, mach_error_t error
,
479 dispatch_mach_handler_function_t f
);
481 #else // !DISPATCH_USE_CLIENT_CALLOUT
483 DISPATCH_ALWAYS_INLINE
485 _dispatch_client_callout(void *ctxt
, dispatch_function_t f
)
490 DISPATCH_ALWAYS_INLINE
492 _dispatch_client_callout2(void *ctxt
, size_t i
, void (*f
)(void *, size_t))
497 DISPATCH_ALWAYS_INLINE
499 _dispatch_client_callout3(void *ctxt
, dispatch_data_t region
, size_t offset
,
500 const void *buffer
, size_t size
, dispatch_data_applier_function_t f
)
502 return f(ctxt
, region
, offset
, buffer
, size
);
505 DISPATCH_ALWAYS_INLINE
507 _dispatch_client_callout4(void *ctxt
, dispatch_mach_reason_t reason
,
508 dispatch_mach_msg_t dmsg
, mach_error_t error
,
509 dispatch_mach_handler_function_t f
);
511 return f(ctxt
, reason
, dmsg
, error
);
514 #endif // !DISPATCH_USE_CLIENT_CALLOUT
517 #define _dispatch_Block_invoke(bb) \
518 ((dispatch_function_t)((struct Block_layout *)bb)->invoke)
519 DISPATCH_ALWAYS_INLINE
521 _dispatch_client_callout_block(dispatch_block_t b
)
523 return _dispatch_client_callout(b
, _dispatch_Block_invoke(b
));
527 dispatch_block_t
_dispatch_Block_copy(dispatch_block_t block
);
528 #define _dispatch_Block_copy(x) ((typeof(x))_dispatch_Block_copy(x))
530 dispatch_block_t
_dispatch_Block_copy(const void *block
);
533 void _dispatch_call_block_and_release(void *block
);
534 #endif /* __BLOCKS__ */
536 void _dispatch_temporary_resource_shortage(void);
537 void *_dispatch_calloc(size_t num_items
, size_t size
);
538 void _dispatch_vtable_init(void);
539 char *_dispatch_get_build(void);
541 uint64_t _dispatch_timeout(dispatch_time_t when
);
543 extern bool _dispatch_safe_fork
, _dispatch_child_of_unsafe_fork
;
545 extern struct _dispatch_hw_config_s
{
546 uint32_t cc_max_active
;
547 uint32_t cc_max_logical
;
548 uint32_t cc_max_physical
;
549 } _dispatch_hw_config
;
551 #if !defined(DISPATCH_USE_OS_SEMAPHORE_CACHE) && !(TARGET_IPHONE_SIMULATOR && \
552 IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1090)
553 #if __has_include(<os/semaphore_private.h>)
554 #define DISPATCH_USE_OS_SEMAPHORE_CACHE 1
555 #include <os/semaphore_private.h>
559 /* #includes dependent on internal.h */
562 // Older Mac OS X and iOS Simulator fallbacks
564 #if HAVE_PTHREAD_WORKQUEUES
565 #ifndef WORKQ_BG_PRIOQUEUE
566 #define WORKQ_BG_PRIOQUEUE 3
568 #ifndef WORKQ_ADDTHREADS_OPTION_OVERCOMMIT
569 #define WORKQ_ADDTHREADS_OPTION_OVERCOMMIT 0x00000001
571 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1070
572 #ifndef DISPATCH_NO_BG_PRIORITY
573 #define DISPATCH_NO_BG_PRIORITY 1
576 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1080
577 #ifndef DISPATCH_USE_LEGACY_WORKQUEUE_FALLBACK
578 #define DISPATCH_USE_LEGACY_WORKQUEUE_FALLBACK 1
581 #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 1080
582 #undef HAVE_PTHREAD_WORKQUEUE_SETDISPATCH_NP
583 #define HAVE_PTHREAD_WORKQUEUE_SETDISPATCH_NP 0
585 #endif // HAVE_PTHREAD_WORKQUEUES
588 #if !defined(MACH_NOTIFY_SEND_POSSIBLE) || (TARGET_IPHONE_SIMULATOR && \
589 IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1070)
590 #undef MACH_NOTIFY_SEND_POSSIBLE
591 #define MACH_NOTIFY_SEND_POSSIBLE MACH_NOTIFY_DEAD_NAME
596 #ifndef DISPATCH_USE_VM_PRESSURE
597 #define DISPATCH_USE_VM_PRESSURE 1
601 #ifdef EVFILT_MEMORYSTATUS
602 #ifndef DISPATCH_USE_MEMORYSTATUS
603 #define DISPATCH_USE_MEMORYSTATUS 1
605 #endif // EVFILT_MEMORYSTATUS
607 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1070
608 #undef DISPATCH_USE_VM_PRESSURE_SOURCE
609 #define DISPATCH_USE_VM_PRESSURE_SOURCE 0
610 #endif // TARGET_IPHONE_SIMULATOR
611 #if TARGET_OS_EMBEDDED
612 #if !defined(DISPATCH_USE_VM_PRESSURE_SOURCE) && DISPATCH_USE_VM_PRESSURE
613 #define DISPATCH_USE_VM_PRESSURE_SOURCE 1
615 #else // !TARGET_OS_EMBEDDED
616 #if !defined(DISPATCH_USE_MEMORYSTATUS_SOURCE) && DISPATCH_USE_MEMORYSTATUS
617 #define DISPATCH_USE_MEMORYSTATUS_SOURCE 1
618 #elif !defined(DISPATCH_USE_VM_PRESSURE_SOURCE) && DISPATCH_USE_VM_PRESSURE
619 #define DISPATCH_USE_VM_PRESSURE_SOURCE 1
621 #endif // TARGET_OS_EMBEDDED
623 #if !defined(NOTE_LEEWAY) || (TARGET_IPHONE_SIMULATOR && \
624 IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1090)
626 #define NOTE_LEEWAY 0
628 #define NOTE_CRITICAL 0
629 #undef NOTE_BACKGROUND
630 #define NOTE_BACKGROUND 0
631 #endif // NOTE_LEEWAY
633 #if HAVE_DECL_NOTE_REAP
634 #if defined(NOTE_REAP) && defined(__APPLE__)
636 #define NOTE_REAP 0x10000000 // <rdar://problem/13338526>
638 #endif // HAVE_DECL_NOTE_REAP
640 #if defined(F_SETNOSIGPIPE) && defined(F_GETNOSIGPIPE)
641 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1070
642 #undef DISPATCH_USE_SETNOSIGPIPE
643 #define DISPATCH_USE_SETNOSIGPIPE 0
645 #ifndef DISPATCH_USE_SETNOSIGPIPE
646 #define DISPATCH_USE_SETNOSIGPIPE 1
648 #endif // F_SETNOSIGPIPE
651 #if HAVE_LIBPROC_INTERNAL_H
653 #include <libproc_internal.h>
654 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1090
655 #undef DISPATCH_USE_IMPORTANCE_ASSERTION
656 #define DISPATCH_USE_IMPORTANCE_ASSERTION 0
658 #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED < 1090
659 #undef DISPATCH_USE_IMPORTANCE_ASSERTION
660 #define DISPATCH_USE_IMPORTANCE_ASSERTION 0
662 #ifndef DISPATCH_USE_IMPORTANCE_ASSERTION
663 #define DISPATCH_USE_IMPORTANCE_ASSERTION 1
665 #endif // HAVE_LIBPROC_INTERNAL_H
667 #if HAVE_SYS_GUARDED_H
668 #include <sys/guarded.h>
669 #if TARGET_IPHONE_SIMULATOR && IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED < 1090
670 #undef DISPATCH_USE_GUARDED_FD
671 #define DISPATCH_USE_GUARDED_FD 0
673 #ifndef DISPATCH_USE_GUARDED_FD
674 #define DISPATCH_USE_GUARDED_FD 1
676 // change_fdguard_np() requires GUARD_DUP <rdar://problem/11814513>
677 #if DISPATCH_USE_GUARDED_FD && RDAR_11814513
678 #define DISPATCH_USE_GUARDED_FD_CHANGE_FDGUARD 1
680 #endif // HAVE_SYS_GUARDED_H
683 #define _dispatch_hardware_crash() __builtin_trap()
685 #define _dispatch_set_crash_log_message(x)
688 // MIG_REPLY_MISMATCH means either:
689 // 1) A signal handler is NOT using async-safe API. See the sigaction(2) man
690 // page for more info.
691 // 2) A hand crafted call to mach_msg*() screwed up. Use MIG.
692 #define DISPATCH_VERIFY_MIG(x) do { \
693 if ((x) == MIG_REPLY_MISMATCH) { \
694 _dispatch_set_crash_log_message("MIG_REPLY_MISMATCH"); \
695 _dispatch_hardware_crash(); \
700 #define DISPATCH_CRASH(x) do { \
701 _dispatch_set_crash_log_message("BUG IN LIBDISPATCH: " x); \
702 _dispatch_hardware_crash(); \
705 #define DISPATCH_CLIENT_CRASH(x) do { \
706 _dispatch_set_crash_log_message("BUG IN CLIENT OF LIBDISPATCH: " x); \
707 _dispatch_hardware_crash(); \
710 #define _OS_OBJECT_CLIENT_CRASH(x) do { \
711 _dispatch_set_crash_log_message("API MISUSE: " x); \
712 _dispatch_hardware_crash(); \
715 /* #includes dependent on internal.h */
716 #include "object_internal.h"
717 #include "semaphore_internal.h"
718 #include "introspection_internal.h"
719 #include "queue_internal.h"
720 #include "source_internal.h"
721 #include "data_internal.h"
723 #include "io_internal.h"
727 #endif /* __DISPATCH_INTERNAL__ */