-
-
Save laevandus/8d32c8a535180098c3b8f98ad3fb954d 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
func store(_ data: Data, forIdentifier id: String) { | |
// Incorrect because read and write happen in separate blocks on the queue | |
// contents[id] = data | |
// Correct | |
queue.async(flags: .barrier) { | |
self._contents[id] = data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment