Skip to content

Commit 3186349

Browse files
committed
Поправка теста для работы с iOS < 10
1 parent 51f3b04 commit 3186349

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Tests/Test_Threadsafety.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ final class Test_Threadsafety: XCTestCase {
4242

4343
// Явно создаю 2 потока, т.к. не известно на скольких потоках будет работать concurrent dispatch queue
4444

45-
let expectation1 = expectation(description: "Thread-1")
46-
Thread.detachNewThread {
45+
let queue1 = DispatchQueue(label: "Queue1")
46+
let expectation1 = expectation(description: "Queue-1")
47+
queue1.async {
4748
for _ in 1 ..< 10 {
4849
_ = assembly.someObject
4950
}
5051
expectation1.fulfill()
5152
}
5253

53-
let expectation2 = expectation(description: "Thread-2")
54-
Thread.detachNewThread {
54+
let queue2 = DispatchQueue(label: "Queue2")
55+
let expectation2 = expectation(description: "Queue-2")
56+
queue2.async {
5557
for _ in 1 ..< 10 {
5658
_ = assembly.someObject
5759
}

0 commit comments

Comments
 (0)