Skip to content

Commit 863dcec

Browse files
committed
[concurrency] stdlib: add a _runAsyncHandler compiler intrinsic.
It just calls Task.runDetatched. It's more efficient to have a non-generic compiler intrinsic than to let the compiler call the generic Task.runDetatched. The _runAsyncHandler doesn't have to be generic because the return value of the run function is defined to be Void.
1 parent 6f5cffb commit 863dcec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ extension Task {
310310

311311
return Handle<T>(task: task)
312312
}
313+
314+
}
315+
316+
public func _runAsyncHandler(operation: @escaping () async -> ()) {
317+
_ = Task.runDetached(operation: operation)
313318
}
314319

315320
// ==== Voluntary Suspension -----------------------------------------------------

0 commit comments

Comments
 (0)