# threads

> threads, a magmalake tin: 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.

[magmalake](https://magmalake.dev/) [threads](https://magmalake.dev/s/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.

Install

```
pixi shelf add threads-mojo
```

Version

`0.6.1` on mojoshelf

Source

[GitHub](https://github.com/magmalake/threads.mojo) [README](https://github.com/magmalake/threads.mojo#readme)

## 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

Checked against Contended-count and memory-visibility proofs designed to give a wrong number, not a flake

- [thrift](https://magmalake.dev/s/thrift) compact + binary protocol
- [zstd](https://magmalake.dev/s/zstd) libzstd
- [lz4](https://magmalake.dev/s/lz4) liblz4
- [brotli](https://magmalake.dev/s/brotli) libbrotli
- [snappy](https://magmalake.dev/s/snappy) pure Mojo
- [deflate](https://magmalake.dev/s/deflate) DEFLATE · gzip · pure Mojo
- [hashes](https://magmalake.dev/s/hashes) CRC-32 · murmur3 · XXH64
- [memory-region](https://magmalake.dev/s/memory-region) bytes addressed by offset · shared mappings
- [Every tin](https://magmalake.dev/tins)

[A magmalake project](https://magmalake.dev/)

Apache 2.0 · © 2026 Marius Seritan
