Specifies the dispatch queue on which to perform work associated with the current object.
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The new target queue for the object. The new queue is retained, and the previous target queue (if any) is released. Specify
NULLif you want the system to provide a queue that is appropriate for the current object.
The target queue determines the queue on which the object's finalizer is invoked. In addition, assigning a target queue affects how you deal with some dispatch objects, as described in the following table.
Implications of assigning a target queue
Redirects all blocks from the current dispatch queue to the specified target queue. Use target queues to redirect work from several different queues onto a single queue. You might do this to minimize the total number of threads your app uses, while still preserving the execution semantics you need. The system doesn't allocate threads to the dispatch queue if it has a target queue, unless that target queue is a global concurrent queue.
The target queue defines where blocks run, but it doesn't change the semantics of the current queue. Blocks submitted to a serial queue still execute serially, even if the underlying target queue is concurrent. In addition, you can't create concurrency where none exists. If a queue and its target queue are both serial, submitting blocks to both queues doesn't cause those blocks to run concurrently. The blocks still run serially in the order the target queue receives them.
A dispatch queue inherits the minimum quality-of-service level from its target queue.
Submits event handler and cancellation handler blocks to the specified target queue.
Dispatch I/O channels
Executes I/O operations on the specified target queue. The quality of service of the target queue affects the priority of the resulting I/O operations. For example, if the target queue's quality of service is