Skip to content

Instantly share code, notes, and snippets.

@deda9
Last active December 20, 2020 18:48
Show Gist options
  • Save deda9/e127020f1adde82a22d9f76c029ebcd4 to your computer and use it in GitHub Desktop.
Save deda9/e127020f1adde82a22d9f76c029ebcd4 to your computer and use it in GitHub Desktop.
How to create global dispatch queue with different priority
//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)
}
}
@rubaiyat6370
Copy link

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.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment