Last active
January 14, 2020 01:21
-
-
Save almaleh/50b1a58c04a93ee7ba9c8f01dca039cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 serial1 = DispatchQueue(label: "com.besher.serial1") | |
let serial2 = DispatchQueue(label: "com.besher.serial2") | |
serial1.sync { // <---- we changed this to 'sync' | |
for _ in 0..<5 { print("🔵") } | |
} | |
// we don't get here until first loop terminates | |
serial2.async { | |
for _ in 0..<5 { print("🔴") } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment