Tins · Primitives
threads
Minimal OS threads for Mojo: spawn and join pthreads, share state through atomics and a mutex, and fan a loop out over cores with parallel_for. A stopgap, distilled from flare, until the language ships its own.
What it does
Works today
- parallel_for over cores — Mojo currently ships no other way to use a second one
- Atomics that bridge the stable/nightly std.atomic split
- Mutex, spawn, join and thread pinning
- Typed parallel_for and TypedPool: shared state held alive by origin, the void* erasure inside the library
Correctness
Checked against Contended-count and memory-visibility proofs designed to give a wrong number, not a flake