Print result is not expect
LukeWei opened this issue · 1 comments
LukeWei commented
Hi ~
I used the sample code run on Xcode 8.2.1 and iPhone 7 Plus simulator.
Here are result for queuesWithQoS() and code.
http://i.imgur.com/cb7WbED.png
func queuesWithQoS() {
let queue1 = DispatchQueue(label: "com.appcoda.queue1", qos: DispatchQoS.userInitiated)
// let queue1 = DispatchQueue(label: "com.appcoda.queue1", qos: DispatchQoS.background)
// let queue2 = DispatchQueue(label: "com.appcoda.queue2", qos: DispatchQoS.userInitiated)
let queue2 = DispatchQueue(label: "com.appcoda.queue2", qos: DispatchQoS.utility)
queue1.async {
for i in 0..<10 {
print("🔴", i)
}
}
queue2.async {
for i in 100..<110 {
print("🔵", i)
}
}
for i in 1000..<1010 {
print("Ⓜ️", i)
}
}
I think queue2 is lower priority than queue1 and main queue.
But the result is not matching their priority.
Main queue is processed at the last one.
How can we explain this?
Or I lost to do something?
LukeWei commented
close