Skip to content

Commit

Permalink
Merge pull request #1218 from spevans/pr_sr_5871
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-ci committed Sep 20, 2017
2 parents b672401 + f2fc172 commit 4f69acb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions TestFoundation/TestThread.swift
Expand Up @@ -41,14 +41,15 @@ class TestThread : XCTestCase {

func test_threadStart() {
let condition = NSCondition()
condition.lock()

let thread = Thread() {
condition.lock()
condition.broadcast()
condition.unlock()
}
thread.start()

condition.lock()

let ok = condition.wait(until: Date(timeIntervalSinceNow: 10))
condition.unlock()
XCTAssertTrue(ok, "NSCondition wait timed out")
Expand Down Expand Up @@ -95,6 +96,8 @@ class TestThread : XCTestCase {
XCTAssertTrue(c.isEqual(t))

let condition = NSCondition()
condition.lock()

let thread = Thread() {
condition.lock()
XCTAssertFalse(Thread.isMainThread)
Expand All @@ -104,7 +107,6 @@ class TestThread : XCTestCase {
}
thread.start()

condition.lock()
let ok = condition.wait(until: Date(timeIntervalSinceNow: 10))
condition.unlock()
XCTAssertTrue(ok, "NSCondition wait timed out")
Expand Down

0 comments on commit 4f69acb

Please sign in to comment.