synchronoise
Rust synchronization primitives that build upon the standard library, ported from .NET and HdrHistogram.
Repository Health
Technical Analysis
Synchronoise is a small, dependency-light Rust crate that fills gaps in the standard library’s threading toolkit. It provides a handful of battle-tested synchronization facilities ported from other ecosystems: a countdown event, signal/reset events, and a writer-reader phaser.
Each primitive is built directly on std::sync atomics plus a lock-free queue from crossbeam, giving you familiar coordination patterns from .NET and Java without pulling in a heavyweight concurrency framework. It is aimed at Rust developers who need thread coordination beyond what std::sync ships with.
What You Get
CountdownEvent— a counter that lets one thread block until other threads bring it to zero, mirroring .NET’sCountdownEvent/ Java’sCountDownLatch.SignalEvent— an event handle with auto-reset and manual-reset modes, ported from .NET’sEventWaitHandle.WriterReaderPhaser— a low-overhead phaser for coordinating readers against writers, ported from HdrHistogram.- A minimal dependency footprint (only
crossbeam-queue) built directly on standard-library atomics. - Extensive rustdoc with runnable examples for each primitive.
Common Use Cases
- Making a coordinator thread wait until a batch of worker threads have all finished.
- Signalling one or many waiting threads that a condition has been met, with automatic or manual reset semantics.
- Phasing reader access around writer flips in histogram-style data collection.
- Adding lightweight thread coordination without adopting a full async runtime.
Under The Hood
Architecture — The crate is split into two focused modules: event.rs (the bulk of the code at ~600 lines) implements CountdownEvent and SignalEvent, while phaser.rs implements WriterReaderPhaser; lib.rs is a thin re-export root. Coordination is built on std::sync::atomic counters and flags, with a lock-free crossbeam_queue::SegQueue used to park and wake waiting threads without a global mutex.
Tech Stack — Pure Rust targeting the standard library with a single runtime dependency, crossbeam-queue 0.3. Licensed MIT OR Apache-2.0, categorized under concurrency on crates.io. No async runtime, no unsafe framework machinery — just atomics and a concurrent queue.
Code Quality — The public types carry thorough rustdoc with runnable, doc-tested examples that double as the primary test surface; there are no separate #[cfg(test)] unit-test modules in src. Naming follows the .NET/Java originals closely, making the semantics predictable for anyone familiar with those constructs. The crate is marked maintenance as-is and has been stable since its 1.0 release.
API Design — The API is deliberately small and ergonomic: construct a primitive, share it across threads via Arc, and call intuitive methods like decrement, wait, signal, and reset. The doc examples get you productive with almost no boilerplate, and the port-faithful naming lowers the learning curve for developers migrating patterns from other languages.