Skip to content

Commit b7e2136

Browse files
committed
[SE-0304] Rename Task.yield() to Task.suspend()
1 parent f692fae commit b7e2136

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ extension Task where Success == Never, Failure == Never {
645645
/// This is not a perfect cure for starvation;
646646
/// if the task is the highest-priority task in the system, it might go
647647
/// immediately back to executing.
648+
///
649+
@available(*, deprecated, renamed: "suspend()")
648650
public static func yield() async {
649651
let currentTask = Builtin.getCurrentAsyncTask()
650652
let priority = getJobFlags(currentTask).priority ?? Task.currentPriority._downgradeUserInteractive
@@ -654,6 +656,11 @@ extension Task where Success == Never, Failure == Never {
654656
_enqueueJobGlobal(job)
655657
}
656658
}
659+
660+
@_alwaysEmitIntoClient
661+
public static func suspend() async {
662+
await yield()
663+
}
657664
}
658665

659666
// ==== UnsafeCurrentTask ------------------------------------------------------

0 commit comments

Comments
 (0)