I tried to increase the priority of the block executed in the concurrent queue. I suggested that the flag enforceQoS is suitable for this purpose. As Apple docs said:
This flag prioritizes the block's quality-of-service class over the one associated with the current execution context, as long as doing so does not lower the quality of service.
Suppose there is a queue:
/// Lowest priority queue
let concurrentQueue = DispatchQueue(label: "queue.conc.test", qos: .background, attributes: .concurrent)
We also have several DispatchWorkItem tasks, some of which are:
let item1 = DispatchWorkItem(qos: .userInitiated) { /* execute block */ }
let item2 = DispatchWorkItem(qos: .utility, flags: .enforceQoS) { /* execute block */ }
My question is simple: does Apple guarantee that item2 execute early?
I played in the playground a little bit and unfortunately didn't reveal any advantages of this flag, the results were absolutely chaotic. The official documentation also didn't help in this matter.
Thanks a lot.