Jump to a problem, path or page
Jump to a problem, path or page
01 · Frame the problem
Design a single-event-loop task group with a concurrency bound and fail-fast cancellation requests. Child factories receive a cooperative abort signal; joining must wait for every started child to settle.
Structured concurrency means the parent retains ownership of every started child until it settles. Analyse failure, queued work, cancellation cooperation and join closure rather than equating cancellation request with task termination.
02 · Find the design pressure
Begin with bounded submission and an active-child set. Returning on first error leaves started tasks orphaned. Stop admission, skip unstarted work and await all started outcomes, recording children that do not immediately honor cancellation.
03 · Define success
04 · Identify the correctness boundary
Track queued and started children separately. On first failure, request cooperative cancellation and skip unstarted work, but join still waits for started children to settle. Cancellation cannot forcibly stop arbitrary child code, so the group must not report completion while a started task is still running.
05 · Make it concrete
With concurrency 2, A and B start while C waits. A fails, C becomes skipped and B receives cancellation. If B ignores cancellation and finishes later, join waits for it and records its outcome. No late child continuation can mutate an already reported group result.