Contents

addTask(priority:operation:)

Adds a child task to the group.

Declaration

mutating func addTask(priority: TaskPriority? = nil, operation: sending @escaping @isolated(any) () async throws -> ChildTaskResult)

Parameters

  • priority:

    The priority of the operation task. Omit this parameter or pass nil to inherit the task group’s base priority.

  • operation:

    The operation to execute as part of the task group.

Discussion

This method doesn’t throw an error, even if the child task does. Instead, the corresponding call to ThrowingTaskGroup.next() rethrows that error.

See Also

Adding Tasks to a Throwing Task Group