Skip to content

Instantly share code, notes, and snippets.

@elnaqah
Last active April 7, 2021 13:02
Show Gist options
  • Save elnaqah/cc83c4bba13d9fa908e6a477f8366811 to your computer and use it in GitHub Desktop.
Save elnaqah/cc83c4bba13d9fa908e6a477f8366811 to your computer and use it in GitHub Desktop.
AsyncTest
func execute(_ block: @escaping ()-> Void) {
block()
}
print("A")
execute {
print("B")
}
print("C")
func execute(_ block: @escaping ()-> Void) {
DispatchQueue.global().async {
block()
}
}
print("A")
execute {
print("B")
}
print("C")
func execute(_ block: @escaping ()-> Void) {
DispatchQueue.global().async {
block()
}
sleep(1)
}
print("A")
execute {
print("B")
}
print("C")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment