Import with #import "std/parallel_linux".
RangeProcedure :: #type (start: s64, end: s64, argument: *void)ParallelLane :: struct { pool: *ParallelPool; index: s32; }ParallelPool :: struct { threads: [63]Thread; lanes: [63]ParallelLane; lock: [8]u64; wake: [8]u64; done: [8]u64; procedure: RangeProcedure; argument: *void; start: s64; end: s64; generation: u64; remaining: s32; workers: s32; active_workers: s32; initialized: bool; stopping: bool; }ParallelCount :: () -> s32Matches checked #parallel regions: four lanes by default, including the submitting thread. ZIRAN_PAR_THREADS=1 is useful for parity and profiling.
ParallelLock :: (pool: *ParallelPool) -> *voidParallelWake :: (pool: *ParallelPool) -> *voidParallelDone :: (pool: *ParallelPool) -> *voidParallelWorker :: (argument: *void)ParallelInit :: (pool: *ParallelPool) -> boolParallelRun :: (pool: *ParallelPool, start: s64, end: s64, procedure: RangeProcedure, argument: *void)Half-open [start, end). The caller guarantees callbacks write only their own range and do not mutate inputs used by another lane. Returning is a completion barrier; all writes are visible and borrowed arguments reusable. Small ranges and thread-creation failure retain exactly the same behavior.
ParallelClose :: (pool: *ParallelPool)