Skip to content

Commit 4f69acb

Browse files
authored
Merge pull request #1218 from spevans/pr_sr_5871
2 parents b672401 + f2fc172 commit 4f69acb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

TestFoundation/TestThread.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ class TestThread : XCTestCase {
4141

4242
func test_threadStart() {
4343
let condition = NSCondition()
44+
condition.lock()
45+
4446
let thread = Thread() {
4547
condition.lock()
4648
condition.broadcast()
4749
condition.unlock()
4850
}
4951
thread.start()
50-
51-
condition.lock()
52+
5253
let ok = condition.wait(until: Date(timeIntervalSinceNow: 10))
5354
condition.unlock()
5455
XCTAssertTrue(ok, "NSCondition wait timed out")
@@ -95,6 +96,8 @@ class TestThread : XCTestCase {
9596
XCTAssertTrue(c.isEqual(t))
9697

9798
let condition = NSCondition()
99+
condition.lock()
100+
98101
let thread = Thread() {
99102
condition.lock()
100103
XCTAssertFalse(Thread.isMainThread)
@@ -104,7 +107,6 @@ class TestThread : XCTestCase {
104107
}
105108
thread.start()
106109

107-
condition.lock()
108110
let ok = condition.wait(until: Date(timeIntervalSinceNow: 10))
109111
condition.unlock()
110112
XCTAssertTrue(ok, "NSCondition wait timed out")

0 commit comments

Comments
 (0)