Skip to content

[Concurrency] Remove deprecated Task.startSynchronously API #82833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions stdlib/public/Concurrency/Task+immediate.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ import Swift
@available(SwiftStdlib 6.2, *)
extension Task where Failure == ${FAILURE_TYPE} {

// FIXME: This method is left in place to give adopters time to switch to `immediate` but it's going
// to be removed soon, since this spelling was rejected as part of SE-0472 proposal.
@available(SwiftStdlib 6.2, *)
@available(*, deprecated, renamed: "immediate")
// Used to preserve the symbols as originally declared without `@isolated(any)` attribute on `operation:`.
% if FAILURE_TYPE == "Error":
@_silgen_name("$sScTss5Error_pRs_rlE18startSynchronously4name8priority_ScTyxsAA_pGSSSg_ScPSgxyYaKcntFZ")
% elif FAILURE_TYPE == "Never":
@_silgen_name("$sScTss5NeverORs_rlE18startSynchronously4name8priority_ScTyxABGSSSg_ScPSgxyYaKcntFZ")
% end
@discardableResult
public static func startSynchronously(
name: String? = nil,
priority: TaskPriority? = nil,
@_implicitSelfCapture @_inheritActorContext(always) _ operation: sending @isolated(any) @escaping () async ${THROWS} -> Success
) -> Task<Success, ${FAILURE_TYPE}> {
immediate(name: name, priority: priority, operation: operation)
}

/// Create and immediately start running a new task in the context of the calling thread/task.
///
/// This function _starts_ the created task on the calling context.
Expand Down
7 changes: 0 additions & 7 deletions test/Concurrency/Runtime/startImmediately.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,6 @@ print("call_startSynchronously_insideActor()")

actor A {
func f() {
Task.startSynchronously(name: "hello") { print("Task.startSynchronously (\(Task.name!))") }
Task.startSynchronously() { print("Task.startSynchronously") }
}

func f2() {
Task.immediate(name: "hello") { print("Task.immediate (\(Task.name!))") }
Task.immediate() { print("Task.immediate") }

Expand All @@ -451,12 +446,10 @@ actor A {

func call_startSynchronously_insideActor() async {
await A().f()
await A().f2()
}

await call_startSynchronously_insideActor()

// CHECK-LABEL: call_startSynchronously_insideActor()
// Those two definitely in this order, however the startSynchronously is not determinate
// CHECK: Task.immediate
// CHECK: Task.immediate { @MainActor }
4 changes: 1 addition & 3 deletions test/abi/macOS/arm64/concurrency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,8 @@ Added: _$sScTss5NeverORszABRs_rlE4nameSSSgvgZ
Added: _$sScTss5NeverORszABRs_rlE4nameSSSgvpZMV
Added: _swift_task_getCurrentTaskName

// startSynchronously, immediate, addImmediateTask{UnlessCancelled}
// immediate, addImmediateTask{UnlessCancelled}
Added: _swift_task_immediate
Added: _$sScTss5Error_pRs_rlE18startSynchronously4name8priority_ScTyxsAA_pGSSSg_ScPSgxyYaKcntFZ
Added: _$sScTss5NeverORs_rlE18startSynchronously4name8priority_ScTyxABGSSSg_ScPSgxyYaKcntFZ

// isIsolatingCurrentContext
Added: _swift_task_invokeSwiftIsIsolatingCurrentContext
Expand Down
4 changes: 1 addition & 3 deletions test/abi/macOS/x86_64/concurrency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,8 @@ Added: _$sScTss5NeverORszABRs_rlE4nameSSSgvgZ
Added: _$sScTss5NeverORszABRs_rlE4nameSSSgvpZMV
Added: _swift_task_getCurrentTaskName

// startSynchronously, immediate, addImmediateTask{UnlessCancelled}
// immediate, addImmediateTask{UnlessCancelled}
Added: _swift_task_immediate
Added: _$sScTss5Error_pRs_rlE18startSynchronously4name8priority_ScTyxsAA_pGSSSg_ScPSgxyYaKcntFZ
Added: _$sScTss5NeverORs_rlE18startSynchronously4name8priority_ScTyxABGSSSg_ScPSgxyYaKcntFZ

// isIsolatingCurrentContext
Added: _swift_task_invokeSwiftIsIsolatingCurrentContext
Expand Down