Static Methodswift 6.0.3_Concurrency
checkCancellation
Throws an error if the task was canceled.
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
static func checkCancellation() throws
The error is always an instance of CancellationError
.
Throws an error if the task was canceled.
static func checkCancellation() throws
sScT12_Concurrencys5NeverORszACRs_rlE17checkCancellationyyKFZ
What are these?ML7Q
The error is always an instance of CancellationError
.
import _Concurrency
@frozen struct Task<Success, Failure> where Success : Sendable, Failure : Error
A unit of asynchronous work.
@frozen enum Never
A type that has no values and can’t be constructed.
static var basePriority: TaskPriority? { get }
The current task’s base priority.
static var currentPriority: TaskPriority { get }
The current task’s priority.
static var isCancelled: Bool { get }
A Boolean value that indicates whether the task should stop executing.
static func sleep<C>(for duration: C.Instant.Duration, tolerance: C.Instant.Duration? = nil, clock: C = ContinuousClock()) async throws where C : Clock
Suspends the current task for the given duration.
static func sleep(nanoseconds duration: UInt64) async throws
Suspends the current task for at least the given duration in nanoseconds.
static func sleep<C>(until deadline: C.Instant, tolerance: C.Instant.Duration? = nil, clock: C = ContinuousClock()) async throws where C : Clock
Suspends the current task until the given deadline within a tolerance.
static func yield() async
Suspends the current task and allows other tasks to execute.
static func CancellationError() -> CancellationError
static func sleep(_ duration: UInt64) async
static func suspend() async
static func withCancellationHandler<T>(handler: () -> Void, operation: () async throws -> T) async rethrows -> T
static func withGroup<TaskResult, BodyResult>(resultType: TaskResult.Type, returning returnType: BodyResult.Type = BodyResult.self, body: (inout Task<Success, Failure>.Group<TaskResult>) async throws -> BodyResult) async rethrows -> BodyResult where TaskResult : Sendable
typealias Group<TaskResult> = ThrowingTaskGroup<TaskResult, any Error> where TaskResult : Sendable
typealias Handle = Task
typealias Priority = TaskPriority