Pranav Jaiswal Pranav Jaiswal - 1 month ago 18
iOS Question

Set priority for custom created serial asynchronous queue

How can I set high priority to a custom created serial asynchronous queue using GCD's?

I had a look at this Q&A where suggestion is made to make use of

dispatch_set_target_queue()
& Pass High Priority Queue (
DISPATCH_QUEUE_PRIORITY_HIGH
) which is a Concurrent Queue to custom serial asynchronous queue.

My understanding is that this will make all the tasks on the Serial Queue Concurrent. Is my understanding correct? If so, what is an alternate solution?

Answer

Your queue will still be serial. It will just be performing its tasks, one at a time, in one slot of the high priority, global, concurrent background queue. Once created, a serial queue cannot be "made concurrent" by any means.

Similarly, if you create a concurrent queue and you set it to target a serial queue, it effectively becomes serial.

This is all covered in this man page.