Instance Method インスタンスメソッド

addTaskUnlessCancelled(priority:operation:)

Adds a child task to the group, unless the group has been canceled.

Declaration 宣言

mutating func addTaskUnlessCancelled(priority: TaskPriority? = nil, operation: @escaping @Sendable () 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.

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.

See Also 参照

Adding Tasks to a Throwing Task Group タスクそれらをあるスローするタスクグループに加える