2 * Copyright (c) 2008-2014 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@
21 #ifndef __DISPATCH_QUEUE__
22 #define __DISPATCH_QUEUE__
24 #ifndef __DISPATCH_INDIRECT__
25 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
26 #include <dispatch/base.h> // for HeaderDoc
29 #if __has_include(<sys/qos.h>)
33 DISPATCH_ASSUME_NONNULL_BEGIN
38 * Dispatch is an abstract model for expressing concurrency via simple but
41 * At the core, dispatch provides serial FIFO queues to which blocks may be
42 * submitted. Blocks submitted to these dispatch queues are invoked on a pool
43 * of threads fully managed by the system. No guarantee is made regarding
44 * which thread a block will be invoked on; however, it is guaranteed that only
45 * one block submitted to the FIFO dispatch queue will be invoked at a time.
47 * When multiple queues have blocks to be processed, the system is free to
48 * allocate additional threads to invoke the blocks concurrently. When the
49 * queues become empty, these threads are automatically released.
53 * @typedef dispatch_queue_t
56 * Dispatch queues invoke blocks submitted to them serially in FIFO order. A
57 * queue will only invoke one block at a time, but independent queues may each
58 * invoke their blocks concurrently with respect to each other.
61 * Dispatch queues are lightweight objects to which blocks may be submitted.
62 * The system manages a pool of threads which process dispatch queues and
63 * invoke blocks submitted to them.
65 * Conceptually a dispatch queue may have its own thread of execution, and
66 * interaction between queues is highly asynchronous.
68 * Dispatch queues are reference counted via calls to dispatch_retain() and
69 * dispatch_release(). Pending blocks submitted to a queue also hold a
70 * reference to the queue until they have finished. Once all references to a
71 * queue have been released, the queue will be deallocated by the system.
73 DISPATCH_DECL(dispatch_queue
);
78 * @function dispatch_async
81 * Submits a block for asynchronous execution on a dispatch queue.
84 * The dispatch_async() function is the fundamental mechanism for submitting
85 * blocks to a dispatch queue.
87 * Calls to dispatch_async() always return immediately after the block has
88 * been submitted, and never wait for the block to be invoked.
90 * The target queue determines whether the block will be invoked serially or
91 * concurrently with respect to other blocks submitted to that same queue.
92 * Serial queues are processed concurrently with respect to each other.
95 * The target dispatch queue to which the block is submitted.
96 * The system will hold a reference on the target queue until the block
98 * The result of passing NULL in this parameter is undefined.
101 * The block to submit to the target dispatch queue. This function performs
102 * Block_copy() and Block_release() on behalf of callers.
103 * The result of passing NULL in this parameter is undefined.
106 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
107 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
109 dispatch_async(dispatch_queue_t queue
, dispatch_block_t block
);
113 * @function dispatch_async_f
116 * Submits a function for asynchronous execution on a dispatch queue.
119 * See dispatch_async() for details.
122 * The target dispatch queue to which the function is submitted.
123 * The system will hold a reference on the target queue until the function
125 * The result of passing NULL in this parameter is undefined.
128 * The application-defined context parameter to pass to the function.
131 * The application-defined function to invoke on the target queue. The first
132 * parameter passed to this function is the context provided to
133 * dispatch_async_f().
134 * The result of passing NULL in this parameter is undefined.
136 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
137 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
139 dispatch_async_f(dispatch_queue_t queue
,
140 void *_Nullable context
,
141 dispatch_function_t work
);
144 * @function dispatch_sync
147 * Submits a block for synchronous execution on a dispatch queue.
150 * Submits a block to a dispatch queue like dispatch_async(), however
151 * dispatch_sync() will not return until the block has finished.
153 * Calls to dispatch_sync() targeting the current queue will result
154 * in dead-lock. Use of dispatch_sync() is also subject to the same
155 * multi-party dead-lock problems that may result from the use of a mutex.
156 * Use of dispatch_async() is preferred.
158 * Unlike dispatch_async(), no retain is performed on the target queue. Because
159 * calls to this function are synchronous, the dispatch_sync() "borrows" the
160 * reference of the caller.
162 * As an optimization, dispatch_sync() invokes the block on the current
163 * thread when possible.
166 * The target dispatch queue to which the block is submitted.
167 * The result of passing NULL in this parameter is undefined.
170 * The block to be invoked on the target dispatch queue.
171 * The result of passing NULL in this parameter is undefined.
174 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
175 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
177 dispatch_sync(dispatch_queue_t queue
, DISPATCH_NOESCAPE dispatch_block_t block
);
181 * @function dispatch_sync_f
184 * Submits a function for synchronous execution on a dispatch queue.
187 * See dispatch_sync() for details.
190 * The target dispatch queue to which the function is submitted.
191 * The result of passing NULL in this parameter is undefined.
194 * The application-defined context parameter to pass to the function.
197 * The application-defined function to invoke on the target queue. The first
198 * parameter passed to this function is the context provided to
200 * The result of passing NULL in this parameter is undefined.
202 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
203 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
205 dispatch_sync_f(dispatch_queue_t queue
,
206 void *_Nullable context
,
207 dispatch_function_t work
);
210 * @function dispatch_apply
213 * Submits a block to a dispatch queue for multiple invocations.
216 * Submits a block to a dispatch queue for multiple invocations. This function
217 * waits for the task block to complete before returning. If the target queue
218 * is concurrent, the block may be invoked concurrently, and it must therefore
221 * Each invocation of the block will be passed the current index of iteration.
224 * The number of iterations to perform.
227 * The target dispatch queue to which the block is submitted.
228 * The result of passing NULL in this parameter is undefined.
231 * The block to be invoked the specified number of iterations.
232 * The result of passing NULL in this parameter is undefined.
235 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
236 DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NOTHROW
238 dispatch_apply(size_t iterations
, dispatch_queue_t queue
,
239 DISPATCH_NOESCAPE
void (^block
)(size_t));
243 * @function dispatch_apply_f
246 * Submits a function to a dispatch queue for multiple invocations.
249 * See dispatch_apply() for details.
252 * The number of iterations to perform.
255 * The target dispatch queue to which the function is submitted.
256 * The result of passing NULL in this parameter is undefined.
259 * The application-defined context parameter to pass to the function.
262 * The application-defined function to invoke on the target queue. The first
263 * parameter passed to this function is the context provided to
264 * dispatch_apply_f(). The second parameter passed to this function is the
265 * current index of iteration.
266 * The result of passing NULL in this parameter is undefined.
268 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
269 DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_NOTHROW
271 dispatch_apply_f(size_t iterations
, dispatch_queue_t queue
,
272 void *_Nullable context
,
273 void (*work
)(void *_Nullable
, size_t));
276 * @function dispatch_get_current_queue
279 * Returns the queue on which the currently executing block is running.
282 * Returns the queue on which the currently executing block is running.
284 * When dispatch_get_current_queue() is called outside of the context of a
285 * submitted block, it will return the default concurrent queue.
287 * Recommended for debugging and logging purposes only:
288 * The code must not make any assumptions about the queue returned, unless it
289 * is one of the global queues or a queue the code has itself created.
290 * The code must not assume that synchronous execution onto a queue is safe
291 * from deadlock if that queue is not the one returned by
292 * dispatch_get_current_queue().
294 * When dispatch_get_current_queue() is called on the main thread, it may
295 * or may not return the same value as dispatch_get_main_queue(). Comparing
296 * the two is not a valid way to test whether code is executing on the
297 * main thread (see dispatch_assert_queue() and dispatch_assert_queue_not()).
299 * This function is deprecated and will be removed in a future release.
302 * Returns the current queue.
304 __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6
,__MAC_10_9
,__IPHONE_4_0
,__IPHONE_6_0
)
305 DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW
307 dispatch_get_current_queue(void);
309 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
310 DISPATCH_EXPORT
struct dispatch_queue_s _dispatch_main_q
;
313 * @function dispatch_get_main_queue
316 * Returns the default queue that is bound to the main thread.
319 * In order to invoke blocks submitted to the main queue, the application must
320 * call dispatch_main(), NSApplicationMain(), or use a CFRunLoop on the main
324 * Returns the main queue. This queue is created automatically on behalf of
325 * the main thread before main() is called.
327 DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_CONST DISPATCH_NOTHROW
329 dispatch_get_main_queue(void)
331 return DISPATCH_GLOBAL_OBJECT(dispatch_queue_t
, _dispatch_main_q
);
335 * @typedef dispatch_queue_priority_t
336 * Type of dispatch_queue_priority
338 * @constant DISPATCH_QUEUE_PRIORITY_HIGH
339 * Items dispatched to the queue will run at high priority,
340 * i.e. the queue will be scheduled for execution before
341 * any default priority or low priority queue.
343 * @constant DISPATCH_QUEUE_PRIORITY_DEFAULT
344 * Items dispatched to the queue will run at the default
345 * priority, i.e. the queue will be scheduled for execution
346 * after all high priority queues have been scheduled, but
347 * before any low priority queues have been scheduled.
349 * @constant DISPATCH_QUEUE_PRIORITY_LOW
350 * Items dispatched to the queue will run at low priority,
351 * i.e. the queue will be scheduled for execution after all
352 * default priority and high priority queues have been
355 * @constant DISPATCH_QUEUE_PRIORITY_BACKGROUND
356 * Items dispatched to the queue will run at background priority, i.e. the queue
357 * will be scheduled for execution after all higher priority queues have been
358 * scheduled and the system will run items on this queue on a thread with
359 * background status as per setpriority(2) (i.e. disk I/O is throttled and the
360 * thread's scheduling priority is set to lowest value).
362 #define DISPATCH_QUEUE_PRIORITY_HIGH 2
363 #define DISPATCH_QUEUE_PRIORITY_DEFAULT 0
364 #define DISPATCH_QUEUE_PRIORITY_LOW (-2)
365 #define DISPATCH_QUEUE_PRIORITY_BACKGROUND INT16_MIN
367 typedef long dispatch_queue_priority_t
;
370 * @typedef dispatch_qos_class_t
371 * Alias for qos_class_t type.
373 #if __has_include(<sys/qos.h>)
374 typedef qos_class_t dispatch_qos_class_t
;
376 typedef unsigned int dispatch_qos_class_t
;
380 * @function dispatch_get_global_queue
383 * Returns a well-known global concurrent queue of a given quality of service
387 * The well-known global concurrent queues may not be modified. Calls to
388 * dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., will
389 * have no effect when used with queues returned by this function.
392 * A quality of service class defined in qos_class_t or a priority defined in
393 * dispatch_queue_priority_t.
395 * It is recommended to use quality of service class values to identify the
396 * well-known global concurrent queues:
397 * - QOS_CLASS_USER_INTERACTIVE
398 * - QOS_CLASS_USER_INITIATED
399 * - QOS_CLASS_DEFAULT
400 * - QOS_CLASS_UTILITY
401 * - QOS_CLASS_BACKGROUND
403 * The global concurrent queues may still be identified by their priority,
404 * which map to the following QOS classes:
405 * - DISPATCH_QUEUE_PRIORITY_HIGH: QOS_CLASS_USER_INITIATED
406 * - DISPATCH_QUEUE_PRIORITY_DEFAULT: QOS_CLASS_DEFAULT
407 * - DISPATCH_QUEUE_PRIORITY_LOW: QOS_CLASS_UTILITY
408 * - DISPATCH_QUEUE_PRIORITY_BACKGROUND: QOS_CLASS_BACKGROUND
411 * Reserved for future use. Passing any value other than zero may result in
412 * a NULL return value.
415 * Returns the requested global queue or NULL if the requested global queue
418 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
419 DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW
421 dispatch_get_global_queue(long identifier
, unsigned long flags
);
424 * @typedef dispatch_queue_attr_t
427 * Attribute for dispatch queues.
429 DISPATCH_DECL(dispatch_queue_attr
);
432 * @const DISPATCH_QUEUE_SERIAL
434 * @discussion A dispatch queue that invokes blocks serially in FIFO order.
436 #define DISPATCH_QUEUE_SERIAL NULL
439 * @const DISPATCH_QUEUE_SERIAL_INACTIVE
442 * A dispatch queue that invokes blocks serially in FIFO order, and that is
443 * created initially inactive. See dispatch_queue_attr_make_initially_inactive().
445 #define DISPATCH_QUEUE_SERIAL_INACTIVE \
446 dispatch_queue_attr_make_initially_inactive(DISPATCH_QUEUE_SERIAL)
449 * @const DISPATCH_QUEUE_CONCURRENT
451 * @discussion A dispatch queue that may invoke blocks concurrently and supports
452 * barrier blocks submitted with the dispatch barrier API.
454 #define DISPATCH_QUEUE_CONCURRENT \
455 DISPATCH_GLOBAL_OBJECT(dispatch_queue_attr_t, \
456 _dispatch_queue_attr_concurrent)
457 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
459 struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent
;
462 * @const DISPATCH_QUEUE_CONCURRENT_INACTIVE
465 * A dispatch queue that may invoke blocks concurrently and supports barrier
466 * blocks submitted with the dispatch barrier API, and that is created initially
467 * inactive. See dispatch_queue_attr_make_initially_inactive().
469 #define DISPATCH_QUEUE_CONCURRENT_INACTIVE \
470 dispatch_queue_attr_make_initially_inactive(DISPATCH_QUEUE_CONCURRENT)
473 * @function dispatch_queue_attr_make_initially_inactive
476 * Returns an attribute value which may be provided to dispatch_queue_create()
477 * or dispatch_queue_create_with_target(), in order to make the created queue
478 * initially inactive.
481 * Dispatch queues may be created in an inactive state. Queues in this state
482 * have to be activated before any blocks associated with them will be invoked.
484 * A queue in inactive state cannot be deallocated, dispatch_activate() must be
485 * called before the last reference to a queue created with this attribute is
488 * The target queue of a queue in inactive state can be changed using
489 * dispatch_set_target_queue(). Change of target queue is no longer permitted
490 * once an initially inactive queue has been activated.
493 * A queue attribute value to be combined with the initially inactive attribute.
496 * Returns an attribute value which may be provided to dispatch_queue_create()
497 * and dispatch_queue_create_with_target().
498 * The new value combines the attributes specified by the 'attr' parameter with
499 * the initially inactive attribute.
501 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
502 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
503 DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
504 dispatch_queue_attr_t
505 dispatch_queue_attr_make_initially_inactive(
506 dispatch_queue_attr_t _Nullable attr
);
509 * @const DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL
512 * A dispatch queue created with this attribute invokes blocks serially in FIFO
513 * order, and surrounds execution of any block submitted asynchronously to it
514 * with the equivalent of a individual Objective-C <code>@autoreleasepool</code>
517 * See dispatch_queue_attr_make_with_autorelease_frequency().
519 #define DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL \
520 dispatch_queue_attr_make_with_autorelease_frequency(\
521 DISPATCH_QUEUE_SERIAL, DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM)
524 * @const DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL
527 * A dispatch queue created with this attribute may invokes blocks concurrently
528 * and supports barrier blocks submitted with the dispatch barrier API. It also
529 * surrounds execution of any block submitted asynchronously to it with the
530 * equivalent of a individual Objective-C <code>@autoreleasepool</code>
532 * See dispatch_queue_attr_make_with_autorelease_frequency().
534 #define DISPATCH_QUEUE_CONCURRENT_WITH_AUTORELEASE_POOL \
535 dispatch_queue_attr_make_with_autorelease_frequency(\
536 DISPATCH_QUEUE_CONCURRENT, DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM)
539 * @typedef dispatch_autorelease_frequency_t
540 * Values to pass to the dispatch_queue_attr_make_with_autorelease_frequency()
543 * @const DISPATCH_AUTORELEASE_FREQUENCY_INHERIT
544 * Dispatch queues with this autorelease frequency inherit the behavior from
545 * their target queue. This is the default behavior for manually created queues.
547 * @const DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM
548 * Dispatch queues with this autorelease frequency push and pop an autorelease
549 * pool around the execution of every block that was submitted to it
551 * @see dispatch_queue_attr_make_with_autorelease_frequency().
553 * @const DISPATCH_AUTORELEASE_FREQUENCY_NEVER
554 * Dispatch queues with this autorelease frequency never set up an individual
555 * autorelease pool around the execution of a block that is submitted to it
556 * asynchronously. This is the behavior of the global concurrent queues.
558 DISPATCH_ENUM(dispatch_autorelease_frequency
, unsigned long,
559 DISPATCH_AUTORELEASE_FREQUENCY_INHERIT
560 DISPATCH_ENUM_AVAILABLE(OSX
, 10.12)
561 DISPATCH_ENUM_AVAILABLE(IOS
, 10.0)
562 DISPATCH_ENUM_AVAILABLE(TVOS
, 10.0)
563 DISPATCH_ENUM_AVAILABLE(WATCHOS
, 3.0) = 0,
564 DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM
565 DISPATCH_ENUM_AVAILABLE(OSX
, 10.12)
566 DISPATCH_ENUM_AVAILABLE(IOS
, 10.0)
567 DISPATCH_ENUM_AVAILABLE(TVOS
, 10.0)
568 DISPATCH_ENUM_AVAILABLE(WATCHOS
, 3.0) = 1,
569 DISPATCH_AUTORELEASE_FREQUENCY_NEVER
570 DISPATCH_ENUM_AVAILABLE(OSX
, 10.12)
571 DISPATCH_ENUM_AVAILABLE(IOS
, 10.0)
572 DISPATCH_ENUM_AVAILABLE(TVOS
, 10.0)
573 DISPATCH_ENUM_AVAILABLE(WATCHOS
, 3.0) = 2,
577 * @function dispatch_queue_attr_make_with_autorelease_frequency
580 * Returns a dispatch queue attribute value with the autorelease frequency
581 * set to the specified value.
584 * When a queue uses the per-workitem autorelease frequency (either directly
585 * or inherithed from its target queue), any block submitted asynchronously to
586 * this queue (via dispatch_async(), dispatch_barrier_async(),
587 * dispatch_group_notify(), etc...) is executed as if surrounded by a individual
588 * Objective-C <code>@autoreleasepool</code> scope.
590 * Autorelease frequency has no effect on blocks that are submitted
591 * synchronously to a queue (via dispatch_sync(), dispatch_barrier_sync()).
593 * The global concurrent queues have the DISPATCH_AUTORELEASE_FREQUENCY_NEVER
594 * behavior. Manually created dispatch queues use
595 * DISPATCH_AUTORELEASE_FREQUENCY_INHERIT by default.
597 * Queues created with this attribute cannot change target queues after having
598 * been activated. See dispatch_set_target_queue() and dispatch_activate().
601 * A queue attribute value to be combined with the specified autorelease
605 * The requested autorelease frequency.
608 * Returns an attribute value which may be provided to dispatch_queue_create()
609 * or NULL if an invalid autorelease frequency was requested.
610 * This new value combines the attributes specified by the 'attr' parameter and
611 * the chosen autorelease frequency.
613 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
614 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
615 DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
616 dispatch_queue_attr_t
617 dispatch_queue_attr_make_with_autorelease_frequency(
618 dispatch_queue_attr_t _Nullable attr
,
619 dispatch_autorelease_frequency_t frequency
);
622 * @function dispatch_queue_attr_make_with_qos_class
625 * Returns an attribute value which may be provided to dispatch_queue_create()
626 * or dispatch_queue_create_with_target(), in order to assign a QOS class and
627 * relative priority to the queue.
630 * When specified in this manner, the QOS class and relative priority take
631 * precedence over those inherited from the dispatch queue's target queue (if
632 * any) as long that does not result in a lower QOS class and relative priority.
634 * The global queue priorities map to the following QOS classes:
635 * - DISPATCH_QUEUE_PRIORITY_HIGH: QOS_CLASS_USER_INITIATED
636 * - DISPATCH_QUEUE_PRIORITY_DEFAULT: QOS_CLASS_DEFAULT
637 * - DISPATCH_QUEUE_PRIORITY_LOW: QOS_CLASS_UTILITY
638 * - DISPATCH_QUEUE_PRIORITY_BACKGROUND: QOS_CLASS_BACKGROUND
642 * dispatch_queue_t queue;
643 * dispatch_queue_attr_t attr;
644 * attr = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL,
645 * QOS_CLASS_UTILITY, 0);
646 * queue = dispatch_queue_create("com.example.myqueue", attr);
650 * A queue attribute value to be combined with the QOS class, or NULL.
654 * - QOS_CLASS_USER_INTERACTIVE
655 * - QOS_CLASS_USER_INITIATED
656 * - QOS_CLASS_DEFAULT
657 * - QOS_CLASS_UTILITY
658 * - QOS_CLASS_BACKGROUND
659 * Passing any other value results in NULL being returned.
661 * @param relative_priority
662 * A relative priority within the QOS class. This value is a negative
663 * offset from the maximum supported scheduler priority for the given class.
664 * Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY
665 * results in NULL being returned.
668 * Returns an attribute value which may be provided to dispatch_queue_create()
669 * and dispatch_queue_create_with_target(), or NULL if an invalid QOS class was
671 * The new value combines the attributes specified by the 'attr' parameter and
672 * the new QOS class and relative priority.
674 __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_8_0
)
675 DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_PURE DISPATCH_NOTHROW
676 dispatch_queue_attr_t
677 dispatch_queue_attr_make_with_qos_class(dispatch_queue_attr_t _Nullable attr
,
678 dispatch_qos_class_t qos_class
, int relative_priority
);
681 * @const DISPATCH_TARGET_QUEUE_DEFAULT
682 * @discussion Constant to pass to the dispatch_queue_create_with_target(),
683 * dispatch_set_target_queue() and dispatch_source_create() functions to
684 * indicate that the default target queue for the object type in question
687 #define DISPATCH_TARGET_QUEUE_DEFAULT NULL
690 * @function dispatch_queue_create_with_target
693 * Creates a new dispatch queue with a specified target queue.
696 * Dispatch queues created with the DISPATCH_QUEUE_SERIAL or a NULL attribute
697 * invoke blocks serially in FIFO order.
699 * Dispatch queues created with the DISPATCH_QUEUE_CONCURRENT attribute may
700 * invoke blocks concurrently (similarly to the global concurrent queues, but
701 * potentially with more overhead), and support barrier blocks submitted with
702 * the dispatch barrier API, which e.g. enables the implementation of efficient
703 * reader-writer schemes.
705 * When a dispatch queue is no longer needed, it should be released with
706 * dispatch_release(). Note that any pending blocks submitted to a queue will
707 * hold a reference to that queue. Therefore a queue will not be deallocated
708 * until all pending blocks have finished.
710 * When using a dispatch queue attribute @a attr specifying a QoS class (derived
711 * from the result of dispatch_queue_attr_make_with_qos_class()), passing the
712 * result of dispatch_get_global_queue() in @a target will ignore the QoS class
713 * of that global queue and will use the global queue with the QoS class
714 * specified by attr instead.
716 * Queues created with dispatch_queue_create_with_target() cannot have their
717 * target queue changed, unless created inactive (See
718 * dispatch_queue_attr_make_initially_inactive()), in which case the target
719 * queue can be changed until the newly created queue is activated with
720 * dispatch_activate().
723 * A string label to attach to the queue.
724 * This parameter is optional and may be NULL.
727 * A predefined attribute such as DISPATCH_QUEUE_SERIAL,
728 * DISPATCH_QUEUE_CONCURRENT, or the result of a call to
729 * a dispatch_queue_attr_make_with_* function.
732 * The target queue for the newly created queue. The target queue is retained.
733 * If this parameter is DISPATCH_TARGET_QUEUE_DEFAULT, sets the queue's target
734 * queue to the default target queue for the given queue type.
737 * The newly created dispatch queue.
739 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
740 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
741 DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
744 dispatch_queue_create_with_target(const char *_Nullable label
,
745 dispatch_queue_attr_t _Nullable attr
, dispatch_queue_t _Nullable target
)
746 DISPATCH_ALIAS_V2(dispatch_queue_create_with_target
);
749 * @function dispatch_queue_create
752 * Creates a new dispatch queue to which blocks may be submitted.
755 * Dispatch queues created with the DISPATCH_QUEUE_SERIAL or a NULL attribute
756 * invoke blocks serially in FIFO order.
758 * Dispatch queues created with the DISPATCH_QUEUE_CONCURRENT attribute may
759 * invoke blocks concurrently (similarly to the global concurrent queues, but
760 * potentially with more overhead), and support barrier blocks submitted with
761 * the dispatch barrier API, which e.g. enables the implementation of efficient
762 * reader-writer schemes.
764 * When a dispatch queue is no longer needed, it should be released with
765 * dispatch_release(). Note that any pending blocks submitted to a queue will
766 * hold a reference to that queue. Therefore a queue will not be deallocated
767 * until all pending blocks have finished.
769 * Passing the result of the dispatch_queue_attr_make_with_qos_class() function
770 * to the attr parameter of this function allows a quality of service class and
771 * relative priority to be specified for the newly created queue.
772 * The quality of service class so specified takes precedence over the quality
773 * of service class of the newly created dispatch queue's target queue (if any)
774 * as long that does not result in a lower QOS class and relative priority.
776 * When no quality of service class is specified, the target queue of a newly
777 * created dispatch queue is the default priority global concurrent queue.
780 * A string label to attach to the queue.
781 * This parameter is optional and may be NULL.
784 * A predefined attribute such as DISPATCH_QUEUE_SERIAL,
785 * DISPATCH_QUEUE_CONCURRENT, or the result of a call to
786 * a dispatch_queue_attr_make_with_* function.
789 * The newly created dispatch queue.
791 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
792 DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
795 dispatch_queue_create(const char *_Nullable label
,
796 dispatch_queue_attr_t _Nullable attr
);
799 * @const DISPATCH_CURRENT_QUEUE_LABEL
800 * @discussion Constant to pass to the dispatch_queue_get_label() function to
801 * retrieve the label of the current queue.
803 #define DISPATCH_CURRENT_QUEUE_LABEL NULL
806 * @function dispatch_queue_get_label
809 * Returns the label of the given queue, as specified when the queue was
810 * created, or the empty string if a NULL label was specified.
812 * Passing DISPATCH_CURRENT_QUEUE_LABEL will return the label of the current
816 * The queue to query, or DISPATCH_CURRENT_QUEUE_LABEL.
819 * The label of the queue.
821 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
822 DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW
824 dispatch_queue_get_label(dispatch_queue_t _Nullable queue
);
827 * @function dispatch_queue_get_qos_class
830 * Returns the QOS class and relative priority of the given queue.
833 * If the given queue was created with an attribute value returned from
834 * dispatch_queue_attr_make_with_qos_class(), this function returns the QOS
835 * class and relative priority specified at that time; for any other attribute
836 * value it returns a QOS class of QOS_CLASS_UNSPECIFIED and a relative
839 * If the given queue is one of the global queues, this function returns its
840 * assigned QOS class value as documented under dispatch_get_global_queue() and
841 * a relative priority of 0; in the case of the main queue it returns the QOS
842 * value provided by qos_class_main() and a relative priority of 0.
845 * The queue to query.
847 * @param relative_priority_ptr
848 * A pointer to an int variable to be filled with the relative priority offset
849 * within the QOS class, or NULL.
853 * - QOS_CLASS_USER_INTERACTIVE
854 * - QOS_CLASS_USER_INITIATED
855 * - QOS_CLASS_DEFAULT
856 * - QOS_CLASS_UTILITY
857 * - QOS_CLASS_BACKGROUND
858 * - QOS_CLASS_UNSPECIFIED
860 __OSX_AVAILABLE_STARTING(__MAC_10_10
, __IPHONE_8_0
)
861 DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NONNULL1 DISPATCH_NOTHROW
863 dispatch_queue_get_qos_class(dispatch_queue_t queue
,
864 int *_Nullable relative_priority_ptr
);
867 * @function dispatch_set_target_queue
870 * Sets the target queue for the given object.
873 * An object's target queue is responsible for processing the object.
875 * When no quality of service class and relative priority is specified for a
876 * dispatch queue at the time of creation, a dispatch queue's quality of service
877 * class is inherited from its target queue. The dispatch_get_global_queue()
878 * function may be used to obtain a target queue of a specific quality of
879 * service class, however the use of dispatch_queue_attr_make_with_qos_class()
880 * is recommended instead.
882 * Blocks submitted to a serial queue whose target queue is another serial
883 * queue will not be invoked concurrently with blocks submitted to the target
884 * queue or to any other queue with that same target queue.
886 * The result of introducing a cycle into the hierarchy of target queues is
889 * A dispatch source's target queue specifies where its event handler and
890 * cancellation handler blocks will be submitted.
892 * A dispatch I/O channel's target queue specifies where where its I/O
893 * operations are executed. If the channel's target queue's priority is set to
894 * DISPATCH_QUEUE_PRIORITY_BACKGROUND, then the I/O operations performed by
895 * dispatch_io_read() or dispatch_io_write() on that queue will be
896 * throttled when there is I/O contention.
898 * For all other dispatch object types, the only function of the target queue
899 * is to determine where an object's finalizer function is invoked.
901 * In general, changing the target queue of an object is an asynchronous
902 * operation that doesn't take effect immediately, and doesn't affect blocks
903 * already associated with the specified object.
905 * However, if an object is inactive at the time dispatch_set_target_queue() is
906 * called, then the target queue change takes effect immediately, and will
907 * affect blocks already associated with the specified object. After an
908 * initially inactive object has been activated, calling
909 * dispatch_set_target_queue() results in an assertion and the process being
912 * If a dispatch queue is active and targeted by other dispatch objects,
913 * changing its target queue results in undefined behavior.
916 * The object to modify.
917 * The result of passing NULL in this parameter is undefined.
920 * The new target queue for the object. The queue is retained, and the
921 * previous target queue, if any, is released.
922 * If queue is DISPATCH_TARGET_QUEUE_DEFAULT, set the object's target queue
923 * to the default target queue for the given object type.
925 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
926 DISPATCH_EXPORT DISPATCH_NOTHROW
928 dispatch_set_target_queue(dispatch_object_t object
,
929 dispatch_queue_t _Nullable queue
);
932 * @function dispatch_main
935 * Execute blocks submitted to the main queue.
938 * This function "parks" the main thread and waits for blocks to be submitted
939 * to the main queue. This function never returns.
941 * Applications that call NSApplicationMain() or CFRunLoopRun() on the
942 * main thread do not need to call dispatch_main().
944 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
945 DISPATCH_EXPORT DISPATCH_NOTHROW DISPATCH_NORETURN
950 * @function dispatch_after
953 * Schedule a block for execution on a given queue at a specified time.
956 * Passing DISPATCH_TIME_NOW as the "when" parameter is supported, but not as
957 * optimal as calling dispatch_async() instead. Passing DISPATCH_TIME_FOREVER
961 * A temporal milestone returned by dispatch_time() or dispatch_walltime().
964 * A queue to which the given block will be submitted at the specified time.
965 * The result of passing NULL in this parameter is undefined.
968 * The block of code to execute.
969 * The result of passing NULL in this parameter is undefined.
972 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
973 DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NOTHROW
975 dispatch_after(dispatch_time_t when
,
976 dispatch_queue_t queue
,
977 dispatch_block_t block
);
981 * @function dispatch_after_f
984 * Schedule a function for execution on a given queue at a specified time.
987 * See dispatch_after() for details.
990 * A temporal milestone returned by dispatch_time() or dispatch_walltime().
993 * A queue to which the given function will be submitted at the specified time.
994 * The result of passing NULL in this parameter is undefined.
997 * The application-defined context parameter to pass to the function.
1000 * The application-defined function to invoke on the target queue. The first
1001 * parameter passed to this function is the context provided to
1002 * dispatch_after_f().
1003 * The result of passing NULL in this parameter is undefined.
1005 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
1006 DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL4 DISPATCH_NOTHROW
1008 dispatch_after_f(dispatch_time_t when
,
1009 dispatch_queue_t queue
,
1010 void *_Nullable context
,
1011 dispatch_function_t work
);
1014 * @functiongroup Dispatch Barrier API
1015 * The dispatch barrier API is a mechanism for submitting barrier blocks to a
1016 * dispatch queue, analogous to the dispatch_async()/dispatch_sync() API.
1017 * It enables the implementation of efficient reader/writer schemes.
1018 * Barrier blocks only behave specially when submitted to queues created with
1019 * the DISPATCH_QUEUE_CONCURRENT attribute; on such a queue, a barrier block
1020 * will not run until all blocks submitted to the queue earlier have completed,
1021 * and any blocks submitted to the queue after a barrier block will not run
1022 * until the barrier block has completed.
1023 * When submitted to a a global queue or to a queue not created with the
1024 * DISPATCH_QUEUE_CONCURRENT attribute, barrier blocks behave identically to
1025 * blocks submitted with the dispatch_async()/dispatch_sync() API.
1029 * @function dispatch_barrier_async
1032 * Submits a barrier block for asynchronous execution on a dispatch queue.
1035 * Submits a block to a dispatch queue like dispatch_async(), but marks that
1036 * block as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
1038 * See dispatch_async() for details.
1041 * The target dispatch queue to which the block is submitted.
1042 * The system will hold a reference on the target queue until the block
1044 * The result of passing NULL in this parameter is undefined.
1047 * The block to submit to the target dispatch queue. This function performs
1048 * Block_copy() and Block_release() on behalf of callers.
1049 * The result of passing NULL in this parameter is undefined.
1052 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
1053 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
1055 dispatch_barrier_async(dispatch_queue_t queue
, dispatch_block_t block
);
1059 * @function dispatch_barrier_async_f
1062 * Submits a barrier function for asynchronous execution on a dispatch queue.
1065 * Submits a function to a dispatch queue like dispatch_async_f(), but marks
1066 * that function as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT
1069 * See dispatch_async_f() for details.
1072 * The target dispatch queue to which the function is submitted.
1073 * The system will hold a reference on the target queue until the function
1075 * The result of passing NULL in this parameter is undefined.
1078 * The application-defined context parameter to pass to the function.
1081 * The application-defined function to invoke on the target queue. The first
1082 * parameter passed to this function is the context provided to
1083 * dispatch_barrier_async_f().
1084 * The result of passing NULL in this parameter is undefined.
1086 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
1087 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
1089 dispatch_barrier_async_f(dispatch_queue_t queue
,
1090 void *_Nullable context
,
1091 dispatch_function_t work
);
1094 * @function dispatch_barrier_sync
1097 * Submits a barrier block for synchronous execution on a dispatch queue.
1100 * Submits a block to a dispatch queue like dispatch_sync(), but marks that
1101 * block as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
1103 * See dispatch_sync() for details.
1106 * The target dispatch queue to which the block is submitted.
1107 * The result of passing NULL in this parameter is undefined.
1110 * The block to be invoked on the target dispatch queue.
1111 * The result of passing NULL in this parameter is undefined.
1114 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
1115 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
1117 dispatch_barrier_sync(dispatch_queue_t queue
,
1118 DISPATCH_NOESCAPE dispatch_block_t block
);
1122 * @function dispatch_barrier_sync_f
1125 * Submits a barrier function for synchronous execution on a dispatch queue.
1128 * Submits a function to a dispatch queue like dispatch_sync_f(), but marks that
1129 * fuction as a barrier (relevant only on DISPATCH_QUEUE_CONCURRENT queues).
1131 * See dispatch_sync_f() for details.
1134 * The target dispatch queue to which the function is submitted.
1135 * The result of passing NULL in this parameter is undefined.
1138 * The application-defined context parameter to pass to the function.
1141 * The application-defined function to invoke on the target queue. The first
1142 * parameter passed to this function is the context provided to
1143 * dispatch_barrier_sync_f().
1144 * The result of passing NULL in this parameter is undefined.
1146 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_4_3
)
1147 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
1149 dispatch_barrier_sync_f(dispatch_queue_t queue
,
1150 void *_Nullable context
,
1151 dispatch_function_t work
);
1154 * @functiongroup Dispatch queue-specific contexts
1155 * This API allows different subsystems to associate context to a shared queue
1156 * without risk of collision and to retrieve that context from blocks executing
1157 * on that queue or any of its child queues in the target queue hierarchy.
1161 * @function dispatch_queue_set_specific
1164 * Associates a subsystem-specific context with a dispatch queue, for a key
1165 * unique to the subsystem.
1168 * The specified destructor will be invoked with the context on the default
1169 * priority global concurrent queue when a new context is set for the same key,
1170 * or after all references to the queue have been released.
1173 * The dispatch queue to modify.
1174 * The result of passing NULL in this parameter is undefined.
1177 * The key to set the context for, typically a pointer to a static variable
1178 * specific to the subsystem. Keys are only compared as pointers and never
1179 * dereferenced. Passing a string constant directly is not recommended.
1180 * The NULL key is reserved and attempts to set a context for it are ignored.
1183 * The new subsystem-specific context for the object. This may be NULL.
1186 * The destructor function pointer. This may be NULL and is ignored if context
1189 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
)
1190 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
1192 dispatch_queue_set_specific(dispatch_queue_t queue
, const void *key
,
1193 void *_Nullable context
, dispatch_function_t _Nullable destructor
);
1196 * @function dispatch_queue_get_specific
1199 * Returns the subsystem-specific context associated with a dispatch queue, for
1200 * a key unique to the subsystem.
1203 * Returns the context for the specified key if it has been set on the specified
1207 * The dispatch queue to query.
1208 * The result of passing NULL in this parameter is undefined.
1211 * The key to get the context for, typically a pointer to a static variable
1212 * specific to the subsystem. Keys are only compared as pointers and never
1213 * dereferenced. Passing a string constant directly is not recommended.
1216 * The context for the specified key or NULL if no context was found.
1218 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
)
1219 DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_PURE DISPATCH_WARN_RESULT
1222 dispatch_queue_get_specific(dispatch_queue_t queue
, const void *key
);
1225 * @function dispatch_get_specific
1228 * Returns the current subsystem-specific context for a key unique to the
1232 * When called from a block executing on a queue, returns the context for the
1233 * specified key if it has been set on the queue, otherwise returns the result
1234 * of dispatch_get_specific() executed on the queue's target queue or NULL
1235 * if the current queue is a global concurrent queue.
1238 * The key to get the context for, typically a pointer to a static variable
1239 * specific to the subsystem. Keys are only compared as pointers and never
1240 * dereferenced. Passing a string constant directly is not recommended.
1243 * The context for the specified key or NULL if no context was found.
1245 __OSX_AVAILABLE_STARTING(__MAC_10_7
,__IPHONE_5_0
)
1246 DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW
1248 dispatch_get_specific(const void *key
);
1251 * @functiongroup Dispatch assertion API
1253 * This API asserts at runtime that code is executing in (or out of) the context
1254 * of a given queue. It can be used to check that a block accessing a resource
1255 * does so from the proper queue protecting the resource. It also can be used
1256 * to verify that a block that could cause a deadlock if run on a given queue
1257 * never executes on that queue.
1261 * @function dispatch_assert_queue
1264 * Verifies that the current block is executing on a given dispatch queue.
1267 * Some code expects to be run on a specific dispatch queue. This function
1268 * verifies that that expectation is true.
1270 * If the currently executing block was submitted to the specified queue or to
1271 * any queue targeting it (see dispatch_set_target_queue()), this function
1274 * If the currently executing block was submitted with a synchronous API
1275 * (dispatch_sync(), dispatch_barrier_sync(), ...), the context of the
1276 * submitting block is also evaluated (recursively).
1277 * If a synchronously submitting block is found that was itself submitted to
1278 * the specified queue or to any queue targeting it, this function returns.
1280 * Otherwise this function asserts: it logs an explanation to the system log and
1281 * terminates the application.
1283 * Passing the result of dispatch_get_main_queue() to this function verifies
1284 * that the current block was submitted to the main queue, or to a queue
1285 * targeting it, or is running on the main thread (in any context).
1287 * When dispatch_assert_queue() is called outside of the context of a
1288 * submitted block (for example from the context of a thread created manually
1289 * with pthread_create()) then this function will also assert and terminate
1292 * The variant dispatch_assert_queue_debug() is compiled out when the
1293 * preprocessor macro NDEBUG is defined. (See also assert(3)).
1296 * The dispatch queue that the current block is expected to run on.
1297 * The result of passing NULL in this parameter is undefined.
1299 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
1300 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
1301 DISPATCH_EXPORT DISPATCH_NONNULL1
1303 dispatch_assert_queue(dispatch_queue_t queue
)
1304 DISPATCH_ALIAS_V2(dispatch_assert_queue
);
1307 * @function dispatch_assert_queue_barrier
1310 * Verifies that the current block is executing on a given dispatch queue,
1311 * and that the block acts as a barrier on that queue.
1314 * This behaves exactly like dispatch_assert_queue(), with the additional check
1315 * that the current block acts as a barrier on the specified queue, which is
1316 * always true if the specified queue is serial (see DISPATCH_BLOCK_BARRIER or
1317 * dispatch_barrier_async() for details).
1319 * The variant dispatch_assert_queue_barrier_debug() is compiled out when the
1320 * preprocessor macro NDEBUG is defined. (See also assert()).
1323 * The dispatch queue that the current block is expected to run as a barrier on.
1324 * The result of passing NULL in this parameter is undefined.
1326 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
1327 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
1328 DISPATCH_EXPORT DISPATCH_NONNULL1
1330 dispatch_assert_queue_barrier(dispatch_queue_t queue
);
1333 * @function dispatch_assert_queue_not
1336 * Verifies that the current block is not executing on a given dispatch queue.
1339 * This function is the equivalent of dispatch_queue_assert() with the test for
1340 * equality inverted. That means that it will terminate the application when
1341 * dispatch_queue_assert() would return, and vice-versa. See discussion there.
1343 * The variant dispatch_assert_queue_not_debug() is compiled out when the
1344 * preprocessor macro NDEBUG is defined. (See also assert(3)).
1347 * The dispatch queue that the current block is expected not to run on.
1348 * The result of passing NULL in this parameter is undefined.
1350 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
1351 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
1352 DISPATCH_EXPORT DISPATCH_NONNULL1
1354 dispatch_assert_queue_not(dispatch_queue_t queue
)
1355 DISPATCH_ALIAS_V2(dispatch_assert_queue_not
);
1358 #define dispatch_assert_queue_debug(q) ((void)(0 && (q)))
1359 #define dispatch_assert_queue_barrier_debug(q) ((void)(0 && (q)))
1360 #define dispatch_assert_queue_not_debug(q) ((void)(0 && (q)))
1362 #define dispatch_assert_queue_debug(q) dispatch_assert_queue(q)
1363 #define dispatch_assert_queue_barrier_debug(q) dispatch_assert_queue_barrier(q)
1364 #define dispatch_assert_queue_not_debug(q) dispatch_assert_queue_not(q)
1369 DISPATCH_ASSUME_NONNULL_END