Skip to content

Instantly share code, notes, and snippets.

@SysCall97
Created April 8, 2024 16:21
Show Gist options
  • Save SysCall97/2e7a64cd610ab4c707395a2dc736be7a to your computer and use it in GitHub Desktop.
Save SysCall97/2e7a64cd610ab4c707395a2dc736be7a to your computer and use it in GitHub Desktop.
import Foundation
// Perform loop 1 to 10 on global concurrent queue with 'userInteractive' QoS
DispatchQueue.global(qos: .userInteractive).async {
for i in 1...10 {
print("Queue 1: \(i)")
}
}
// Perform loop 11 to 20 on global concurrent queue with 'userInitiated' QoS
DispatchQueue.global(qos: .userInitiated).async {
for i in 11...20 {
print("Queue 2: \(i)")
}
}
// Perform loop 21 to 30 on global concurrent queue with 'utility' QoS
DispatchQueue.global(qos: .utility).async {
for i in 21...30 {
print("Queue 3: \(i)")
}
}
// Perform loop 31 to 40 on global concurrent queue with 'background' QoS
DispatchQueue.global(qos: .background).async {
for i in 31...40 {
print("Queue 4: \(i)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment