Instance Methodswift 6.0.1_Concurrency
addTaskUnlessCancelled(priority:operation:)
Adds a child task to the group, unless the group has been canceled.
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
mutating func addTaskUnlessCancelled(priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult) -> Bool
Parameters
- overridingPriority
The priority of the operation task. Omit this parameter or pass
.unspecified
to set the child task’s priority to the priority of the group.- operation
The operation to execute as part of the task group.
Returns
true
if the child task was added to the group; otherwise false
.
This method doesn’t throw an error, even if the child task does. Instead, the corresponding call to ThrowingTaskGroup.next()
rethrows that error.
Other members in extension
Instance members
var isCancelled: Bool
A Boolean value that indicates whether the group was canceled.
var isEmpty: Bool
A Boolean value that indicates whether the group has any remaining tasks.
func addTask(priority: TaskPriority?, operation: sending
Adds a child task to the group.
func cancelAll(
) Cancel all of the remaining tasks in the group.
func next(
) async throws -> ChildTaskResult? func next(isolation: isolated (any Actor)?
) async throws -> ChildTaskResult? Wait for the next child task to complete, and return the value it returned or rethrow the error it threw.
func nextResult(isolation: isolated (any Actor)?
) async -> Result<ChildTaskResult, Failure>? Wait for the next child task to complete, and return a result containing either the value that the child task returned or the error that it threw.
func waitForAll(isolation: isolated (any Actor)?
) async throws Wait for all of the group’s remaining tasks to complete.