Created
October 13, 2016 19:32
-
-
Save abbeyjackson/9864327096623fce0f7427fb1422e3c9 to your computer and use it in GitHub Desktop.
This file contains 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
Creating a concurrent queue | |
let concurrentQueue = DispatchQueue(label: "queuename", attributes: .concurrent) | |
concurrentQueue.sync { | |
} | |
Create a serial queue | |
let serialQueue = DispatchQueue(label: "queuename") | |
serialQueue.sync { | |
} | |
Get main queue asynchronously | |
DispatchQueue.main.async { | |
} | |
Get main queue synchronously | |
DispatchQueue.main.sync { | |
} | |
To get one of the background thread | |
DispatchQueue.global(attributes: .qosDefault).async { | |
} | |
Xcode 8 beta 5: | |
To get one of the background thread | |
DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async { | |
} | |
DispatchQueue.global().async { | |
// qos' default value is ´DispatchQoS.QoSClass.default` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment