Skip to main content

function

sync_parallelize

sync_parallelize[func: fn(Int, /) capturing -> None](num_work_items: Int)

Executes func(0) ... func(num_work_items-1) as parallel sub-tasks, and returns when all are complete.

Parameters:

  • func (fn(Int, /) capturing -> None): The function to invoke.

Args:

  • num_work_items (Int): Number of parallel tasks.

sync_parallelize[func: fn(Int) raises capturing -> None](num_work_items: Int)

Executes func(0) ... func(num_work_items-1) as parallel sub-tasks, and returns when all are complete.

TODO: Currently exceptions raised by func will cause a trap rather than be propagated back to the caller.

Parameters:

  • func (fn(Int) raises capturing -> None): The function to invoke.

Args:

  • num_work_items (Int): Number of parallel tasks.