Created
August 5, 2019 08:47
-
-
Save wotjd/c9a8ab7c014127485ec2557191d0c1bf 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
import Foundation | |
DispatchQueue.global().sync { | |
print("hi") | |
} | |
print("good") | |
let serial = DispatchQueue(label: "Serial") | |
let concurrent = DispatchQueue(label: "Concurrent", attributes: .concurrent) | |
concurrent.async { | |
print("concurrent async in") | |
// it works! | |
concurrent.sync { | |
print("concurrent sync of concurrent async") | |
} | |
print("concurrent async out") | |
} | |
serial.async { | |
print("serial async in") | |
// X_X | |
serial.sync { | |
print("serial sync of serial async") | |
} | |
print("serial async out") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment