Skip to content

Instantly share code, notes, and snippets.

@shoheiyokoyama
Created May 6, 2017 08:27
Show Gist options
  • Save shoheiyokoyama/065024e817fe07145c16493040ac040b to your computer and use it in GitHub Desktop.
Save shoheiyokoyama/065024e817fe07145c16493040ac040b to your computer and use it in GitHub Desktop.
DispatchWorkItem notify
let queue = DispatchQueue(label: "queue", attributes: .concurrent)
let workItem = DispatchWorkItem {
sleep(2)
print("done")
}
queue.async(execute: workItem)
workItem.notify(queue: .main) {
print("notify!")
}
//done
//notify!
@rgkobashi
Copy link

concise and clear, thanks!

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