File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -42,16 +42,18 @@ final class Test_Threadsafety: XCTestCase {
42
42
43
43
// Явно создаю 2 потока, т.к. не известно на скольких потоках будет работать concurrent dispatch queue
44
44
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 {
47
48
for _ in 1 ..< 10 {
48
49
_ = assembly. someObject
49
50
}
50
51
expectation1. fulfill ( )
51
52
}
52
53
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 {
55
57
for _ in 1 ..< 10 {
56
58
_ = assembly. someObject
57
59
}
You can’t perform that action at this time.
0 commit comments