Skip to content

Commit 4a0723f

Browse files
committed
[SE-0304] Add UnsafeCurrentTask.cancel().
1 parent 7ba63cf commit 4a0723f

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
@@ -712,6 +712,11 @@ public struct UnsafeCurrentTask {
712712
public var priority: TaskPriority {
713713
getJobFlags(_task).priority ?? .unspecified
714714
}
715+
716+
/// Cancel the current task.
717+
public func cancel() {
718+
_taskCancel(_task)
719+
}
715720
}
716721

717722
@available(SwiftStdlib 5.5, *)

0 commit comments

Comments
 (0)