An unsafe reference to the current task.
To get an instance of
UnsafeCurrentTask for the current task, call the
withUnsafeCurrentTask(body:) method. Don’t store an unsafe task reference for use outside that method’s closure. Storing an unsafe reference doesn’t affect the task’s actual life cycle, and the behavior of accessing an unsafe task reference outside of the
withUnsafeCurrentTask(body:) method’s closure isn’t defined.
Only APIs on
UnsafeCurrentTask that are also part of
Task are safe to invoke from a task other than the task that this
UnsafeCurrentTask instance refers to. Calling other APIs from another task is undefined behavior, breaks invariants in other parts of the program running on this task, and may lead to crashes or data loss.
Citizens in _Concurrency
A type that can be compared for value equality.
A type that can be hashed into a
Hasherto produce an integer hash value.
var basePriority: TaskPriority
The current task’s base priority.
var isCancelled: Bool
A Boolean value that indicates whether the current task was canceled.
var priority: TaskPriority
The current task’s priority.
static func == (UnsafeCurrentTask, UnsafeCurrentTask
) -> Bool
Cancel the current task.
func hash(into: inout Hasher