Last active
May 30, 2018 20:26
-
-
Save regularberry/65c99ba268655282cccfc5f35a745840 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 testMutableClass() { | |
let group = DispatchGroup() | |
let obj = MutableClass() | |
for _ in 0...1000 { | |
group.enter() | |
DispatchQueue.global().async { | |
let sleepVal = arc4random() % 1000 | |
usleep(sleepVal) | |
obj.update(newVal: 42) | |
group.leave() | |
} | |
} | |
let result = group.wait(timeout: DispatchTime.now() + 5) | |
XCTAssert(result == .success) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment