Skip to content

Commit d95577a

Browse files
committed
[SE-0304] Add UnsafeCurrentTask.cancel().
1 parent 73e5806 commit d95577a

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
@@ -759,6 +759,11 @@ public struct UnsafeCurrentTask {
759759
public var priority: TaskPriority {
760760
getJobFlags(_task).priority ?? .unspecified
761761
}
762+
763+
/// Cancel the current task.
764+
public func cancel() {
765+
_taskCancel(_task)
766+
}
762767
}
763768

764769
@available(SwiftStdlib 5.5, *)

0 commit comments

Comments
 (0)