Skip to content

Commit dde6bcf

Browse files
committed
turbo-tasks: add scope_unbounded, a work-stealing scope with a growing work queue
A parallel scope where the `run` closure receives a `Spawner` and may enqueue more items while the scope drains — unlike `scope_and_block`'s fixed job set. Completes once every item (initial + transitively spawned) is processed; termination is driven by an in-flight counter reaching zero. Deadlock-safe on thread-limited/contended runtimes: the calling thread drains the whole (growing) queue itself if no helper task is scheduled, so liveness never depends on a helper. Needed to parallelize work pools that discover more work as they run (the GC collection pass, later in the stack). 16 unit tests cover the drain loop, the empty/tree/panic cases, and the current-thread-runtime (zero-helper) liveness property.
1 parent dd28201 commit dde6bcf

1 file changed

Lines changed: 422 additions & 2 deletions

File tree

  • turbopack/crates/turbo-tasks/src

0 commit comments

Comments
 (0)