Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParallelForN ¶
ParallelForN runs fn(0..n-1) in parallel across runtime.GOMAXPROCS(0) worker goroutines. Indices are partitioned into contiguous chunks so the number of spawned goroutines stays bounded regardless of n.
fn must be safe to call concurrently from different goroutines (each call receives its own unique index). Output collected by writing to indexed slots in a pre-allocated slice is a common safe pattern.
Returns the first non-nil error reported by fn; other workers may still be finishing briefly afterwards.
Types ¶
Click to show internal directories.
Click to hide internal directories.