Skip to content

Commit cfed6b2

Browse files
committed
[Concurrency] Provide an alternative implementation when "async { }" is unusable
There exist Swift builds that support `Sendable` but not the attributes used on `async`. Make sure that have an implementation of `_runTaskForBridgedAsyncMethod` that does something. Fixes rdar://77637570. (cherry picked from commit 9788cc2)
1 parent b51e3c8 commit cfed6b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,10 @@ func _getCurrentThreadPriority() -> Int
10231023
@_alwaysEmitIntoClient
10241024
@usableFromInline
10251025
internal func _runTaskForBridgedAsyncMethod(_ body: @escaping () async -> Void) {
1026-
#if compiler(>=5.5) && $Sendable
1026+
#if compiler(>=5.5) && $Sendable && $InheritActorContext && $ImplicitSelfCapture
10271027
async { await body() }
1028+
#else
1029+
detach { await body() }
10281030
#endif
10291031
}
10301032

0 commit comments

Comments
 (0)