Skip to content

Instantly share code, notes, and snippets.

@marmelroy
Created July 19, 2016 05:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marmelroy/6b5ab63dad4056f3d156edcaedc60a0d to your computer and use it in GitHub Desktop.
Save marmelroy/6b5ab63dad4056f3d156edcaedc60a0d to your computer and use it in GitHub Desktop.
let queue = DispatchQueue.global(attributes: .qosUserInitiated)
let mainQueue = DispatchQueue.main
mainQueue.async {
dispatchPrecondition(condition: .notOnQueue(mainQueue))
// This code won't execute
}
queue.async {
dispatchPrecondition(condition: .onQueue(queue))
// This code will execute
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment