Created
May 6, 2017 08:27
-
-
Save shoheiyokoyama/065024e817fe07145c16493040ac040b to your computer and use it in GitHub Desktop.
DispatchWorkItem notify
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
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! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
concise and clear, thanks!