Skip to content

Commit 39e97c5

Browse files
committed
[Concurrency] add deprecated shim for runDetached
1 parent 54a0e19 commit 39e97c5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,20 @@ extension Task {
361361

362362
// ==== Detached Tasks ---------------------------------------------------------
363363

364+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
365+
extension Task {
366+
367+
@discardableResult
368+
@available(*, deprecated, message: "`Task.runDetached` was replaced by `detach` and will be removed shortly.")
369+
public func runDetached<T>(
370+
priority: Task.Priority = .unspecified,
371+
operation: __owned @Sendable @escaping () async -> T
372+
) -> Task.Handle<T, Never> {
373+
detach(priority: priority, operation: operation)
374+
}
375+
376+
}
377+
364378
/// Run given throwing `operation` as part of a new top-level task.
365379
///
366380
/// Creating detached tasks should, generally, be avoided in favor of using

0 commit comments

Comments
 (0)