Skip to content

Commit d36a85d

Browse files
Remove DispatchShims.swift and replace it with a conditional typealias
The use of DispatchQueue in XCTest is now very limited, and it's only used in a single place in XCTestCase.swift.
1 parent 9decbc4 commit d36a85d

File tree

3 files changed

+17
-49
lines changed

3 files changed

+17
-49
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ add_library(XCTest
3838
Sources/XCTest/Private/WaiterManager.swift
3939
Sources/XCTest/Private/IgnoredErrors.swift
4040
Sources/XCTest/Private/XCTestCase.TearDownBlocksState.swift
41-
Sources/XCTest/Private/DispatchShims.swift
4241
Sources/XCTest/Public/XCTestRun.swift
4342
Sources/XCTest/Public/XCTestMain.swift
4443
Sources/XCTest/Public/XCTestCase.swift

Sources/XCTest/Private/DispatchShims.swift

Lines changed: 0 additions & 47 deletions
This file was deleted.

Sources/XCTest/Public/XCTestCase.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,23 @@ open class XCTestCase: XCTest {
5454
return 1
5555
}
5656

57-
internal static let subsystemQueue = DispatchQueue(label: "org.swift.XCTestCase")
57+
#if DISABLE_XCTWAITER
58+
/// Single-threaded queue without any actual queueing
59+
struct SubsystemQueue {
60+
init(label: String) {}
61+
62+
func sync<T>(_ body: () -> T) -> T {
63+
body()
64+
}
65+
func async(_ body: @escaping () -> Void) {
66+
body()
67+
}
68+
}
69+
#else
70+
typealias SubsystemQueue = DispatchQueue
71+
#endif
72+
73+
internal static let subsystemQueue = SubsystemQueue(label: "org.swift.XCTestCase")
5874

5975
#if !DISABLE_XCTWAITER
6076
@MainActor

0 commit comments

Comments
 (0)