[Concurrency] Structured concurrency

Right yeah... we're in the middle of figuring out what the default behavior should be; some of the writeup had assumed cancelling while some of it did waiting on the returning edge.

Other implementations of this concept opt for awaiting all outstanding work, and cancelling on the group failing which is what we're closing in on as the default; Yes the above example would need a cancelAll() then.

For every example where cancelling outstanding work makes sense there's other examples which make sense with implicitly waiting. I'm kind of hoping we leave this up as configuration parameter when starting a task group (or may be Task.Group.awaitAll { ... } or Task.Group.cancelPending { ... }?).

(Currently the proposal is assuming waiting).

Exact shapes not yet decided and we'll only get a commitment here once we've had a chance to implement and use the APIs a little bit more, hopefully very soon.

2 Likes