Skip to content

Commit 1f198bc

Browse files
committed
Cleaning up _runAsyncMain a bit
I'm making two cleanups here. First, the closure going into `_runAsyncMain` needs to be `@Sendable` or passing it to the task is not safe. This will also result in a warning being emitted. Second, I'm making this @usableFromInline and `internal`. This function is around for legacy reasons, but it's part of the ABI, so we can't pull it out entirely, but we don't want folks using it.
1 parent 0e5a620 commit 1f198bc

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
@@ -807,7 +807,9 @@ internal func _asyncMainDrainQueue() -> Never
807807
internal func _getMainExecutor() -> Builtin.Executor
808808

809809
@available(SwiftStdlib 5.1, *)
810-
public func _runAsyncMain(_ asyncFun: @escaping () async throws -> ()) {
810+
@usableFromInline
811+
@_predatesConcurrency
812+
internal func _runAsyncMain(_ asyncFun: @Sendable @escaping () async throws -> ()) {
811813
Task.detached {
812814
do {
813815
#if !os(Windows)

0 commit comments

Comments
 (0)