A Web Worker based multithreading library for Rust and WebAssembly.
This uses the WebAssembly threads proposal
and shared memory to communicate between workers (once they are started), instead of postMessage.
The threads proposal is currently in phase 4 and available in all major browsers and runtimes.
At the current stage, this is the closest thing to std::thread::spawn
that "Just Works" for wasm32-unknown-unknown target. For example you can:
- Spawn a thread with a Rust closure
- Join a thread
- Send data between threads using channels
- Synchronize threads using
std::syncprimitives
Nightly Rust toolchain is required for unstable features. This library
will remain on version 0.0.x until all features required are in stable Rust,
standardized in WASM, and baseline widely available across browsers.
The Playground has runnable examples and links to their source code on GitHub.
- For setup, tutorial, and concepts, please refer to the book.
- For technical reference, refer to API documentation on docs.rs.
- There is also a blog post I wrote when I first made this library
Contribution is accepted. Please refer to the Contribution Guidelines