Creates a new dispatch block from an existing block and the given flags, and assigns it the specified quality-of-service class and relative priority.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
Configuration flags for the block object. For possible values, see
_block _flags _t
Passing a value that is not a bitwise OR of valid flags results in
The QoS class. For possible values, see Quality of Service Classes (QoS).
QOSis equivalent to specifying the
_BLOCK _NO _QOS _CLASS
Passing any other value results in
A relative priority within the QoS class.
This value is a negative offset from the maximum supported scheduler priority for the given class. Passing a value greater than zero or less than
_MIN _RELATIVE _PRIORITY
The block to create the dispatch block from.
The provided block is copied to the heap and retained by the newly created dispatch block.
The returned dispatch block is intended to be submitted to a dispatch queue with
dispatch and related functions, but may also be invoked directly. Both operations can be performed an arbitrary number of times but only the first completed execution of a dispatch block can be waited on with
dispatch or observed with
If invoked directly, the returned dispatch block is executed with the assigned QoS class as long as that does not result in a lower QoS class than what is current on the calling thread.
If the returned dispatch block is submitted to a dispatch queue, the QoS class it is executed with depends on the QoS class assigned to the block, the QoS class assigned to the queue and which of the following flags was specified or defaulted to:
DISPATCH(default for asynchronous execution)
_BLOCK _INHERIT _QOS _CLASS
DISPATCH(default for synchronous execution)
_BLOCK _ENFORCE _QOS _CLASS
If the returned dispatch block is submitted directly to a serial queue and is configured to execute with a specific QoS class, the system makes a best effort to apply the necessary QoS overrides to ensure that blocks submitted earlier to the serial queue are executed at that same QoS class or higher.
dispatch for more information.