File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,15 @@ class TestThread : XCTestCase {
41
41
42
42
func test_threadStart( ) {
43
43
let condition = NSCondition ( )
44
+ condition. lock ( )
45
+
44
46
let thread = Thread ( ) {
45
47
condition. lock ( )
46
48
condition. broadcast ( )
47
49
condition. unlock ( )
48
50
}
49
51
thread. start ( )
50
-
51
- condition. lock ( )
52
+
52
53
let ok = condition. wait ( until: Date ( timeIntervalSinceNow: 10 ) )
53
54
condition. unlock ( )
54
55
XCTAssertTrue ( ok, " NSCondition wait timed out " )
@@ -95,6 +96,8 @@ class TestThread : XCTestCase {
95
96
XCTAssertTrue ( c. isEqual ( t) )
96
97
97
98
let condition = NSCondition ( )
99
+ condition. lock ( )
100
+
98
101
let thread = Thread ( ) {
99
102
condition. lock ( )
100
103
XCTAssertFalse ( Thread . isMainThread)
@@ -104,7 +107,6 @@ class TestThread : XCTestCase {
104
107
}
105
108
thread. start ( )
106
109
107
- condition. lock ( )
108
110
let ok = condition. wait ( until: Date ( timeIntervalSinceNow: 10 ) )
109
111
condition. unlock ( )
110
112
XCTAssertTrue ( ok, " NSCondition wait timed out " )
You can’t perform that action at this time.
0 commit comments