Last active
December 20, 2020 18:48
-
-
Save deda9/e127020f1adde82a22d9f76c029ebcd4 to your computer and use it in GitHub Desktop.
How to create global dispatch queue with different priority
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//With Different priority | |
let dispatchQueue1 = DispatchQueue(label: "Queue 1", qos: .userInteractive) | |
let dispatchQueue2 = DispatchQueue(label: "Queue 2", qos: .background) | |
dispatchQueue1.async { | |
for i in 0..<5 { | |
print("DispatchQueue X ", i) | |
} | |
} | |
dispatchQueue2.async { | |
for i in 5..<10 { | |
print("DispatchQueue Y ", i) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know why change of priority does not change the execution order in my code. Its always like both queue has the same priority.
