Skip to content
run_bands

run_bands

Mojo function 🡭

run_bands

fn def run_bands(bands: Int, work: T)

Run work(b) for every band b in 0 <= b < bands and return once all have finished. One band runs on the caller’s thread, so the serial case costs no task; more run as tasks on the runtime’s pool. work is typically a closure over the pass’s context with a capture list naming each value it reads or writes, and the bands must write disjoint rows or slots, which is each pass’s own argument to make. work cannot raise: a task is a non-raising coroutine, so a band reports a failure through what it writes.

Args:

  • bands (Int): How many bands; from _bands_for or _bands_for_work.
  • work (T): The band body, given the band index.