runAll<T> abstract method

Future<List<T>> runAll<T>(
  1. Iterable<ChildJob<T>> children
)

Runs children side by side and stops the rest as soon as one of them goes wrong.

Starts every child synchronously, in the order of the list, and returns their values in that same order. As soon as the body of a branch ends in anything but a value, the other branches are asked to stop with SiblingCancelReason, and the group throws a real failure if there is one, otherwise the first cancellation that arrived.

Admission errors are those of run, and the same handle twice is an ArgumentError. A refusal found before the first start starts none of the handles, the sound ones included; one only the adoption can give may come after some have started, and stops them. A handle refused or never started stays with the code that made it, its done waiting until that code starts or cancels it.

A branch must not wait for another branch of the same group — for its Job.value or Job.done, or for a lock or a slot of a pool it releases in its cleanup. No branch unwinds before the group has decided, so the group hangs, with no timer and no error. Take such a lock in a child of the branch, which releases it when the child ends, still inside the body, or use [a, b].wait, under which every branch unwinds on its own.

How this differs from .wait and Future.wait is in When one failure makes the rest pointless on the groups page, the hang in Branches that wait for each other, and the refusals in When ctx.run refuses a child on the children page.

Implementation

Future<List<T>> runAll<T>(Iterable<ChildJob<T>> children);