-
-
Save laevandus/766c4fd7093f92a246667663ad9b93c8 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 testThreadSafety() throws { | |
let iterations = 100 | |
let storage = Storage() | |
DispatchQueue.concurrentPerform(iterations: iterations) { index in | |
storage.store(Data(), forIdentifier: "\(index)") | |
} | |
XCTAssertEqual(storage.numberOfItems, iterations) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment