addTaskUnlessCancelled(priority:operation:)
Adds a child task to the group, unless the group has been canceled. Returns a boolean value indicating if the task was successfully added to the group or not.
Declaration
mutating func addTaskUnlessCancelled(priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> Void) -> BoolParameters
- priority:
The priority of the operation task. Omit this parameter or pass
nilto inherit the task group’s base priority. - operation:
The operation to execute as part of the task group.
Return Value
true if the child task was added to the group; otherwise false.
Discussion
This method doesn’t throw an error, even if the child task does. Instead, the corresponding call to ThrowingTaskGroup.next() rethrows that error.