Skip to content

Commit 7b1a918

Browse files
authored
Fix warning - Sending value of non-Sendable type '() async -> ()' risks causing data races (#8937)
### Motivation: Warning: Sending value of non-Sendable type '() async -> ()' risks causing data races; this is an error in the Swift 6 language mode ### Modifications: Require template type to inherit from Sendable
1 parent 4c1e060 commit 7b1a918

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Basics/Concurrency/ConcurrencyHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public enum Concurrency {
2626
}
2727

2828
@available(*, noasync, message: "This method blocks the current thread indefinitely. Calling it from the concurrency pool can cause deadlocks")
29-
public func unsafe_await<T>(_ body: @Sendable @escaping () async -> T) -> T {
29+
public func unsafe_await<T: Sendable>(_ body: @Sendable @escaping () async -> T) -> T {
3030
let semaphore = DispatchSemaphore(value: 0)
3131

3232
let box = ThreadSafeBox<T>()

0 commit comments

Comments
 (0)