moirai-sync 0.7.0

Synchronization primitives for Moirai concurrency library
Documentation

moirai-sync

crates.io docs.rs

Synchronization primitives for the Moirai concurrency library. The crate re-exports std::sync's Mutex, RwLock, Condvar, and Barrier unchanged and adds only primitives whose behavior std does not provide:

  • FutexMutex — adaptive spinning with futex-backed waiting on Linux.
  • WaitGroup — Go-style completion counter.
  • ConcurrentHashMap — segment-based locking, with poisoning surfaced as a typed SegmentPoisoned error rather than a panic.
  • ShardedResourcePool — sharded pooling of reusable resources.
  • LockFreeStack (re-exported from moirai-core) and AtomicCounter (re-exported from moirai-utils).
[dependencies]
moirai-sync = "0.5"
use moirai_sync::{FutexMutex, WaitGroup};

let mutex = FutexMutex::new(0u32);
{
    let mut guard = mutex.lock(); // returns the guard directly, not a Result
    *guard += 1;
}

let wg = WaitGroup::new();
wg.add(1);
wg.done();
wg.wait();

Full documentation: https://docs.rs/moirai-sync

License

Licensed under either of Apache-2.0 or MIT at your option.