Expand description
Advanced async synchronization primitives for Moirai
This module provides async-aware synchronization that integrates with Moirai’s unified runtime. Following SLAP principle, each synchronization primitive is implemented in its own focused module.
§Wake discipline
Every primitive here takes the waker — or the wakers — out from under its
state lock and wakes only after the guard is released. Waker::wake may poll
the task inline on the calling thread, and that poll re-locks the same state,
so waking under the lock is a self-deadlock. hybrid::notify states the rule
for its registries, and timer’s driver follows it by dropping its guard
before waking. A new release/notify path belongs to this rule rather than to
a local judgement — the sites that got it wrong were the ones that decided
per-site.
Re-exports§
pub use broadcast::Broadcast;pub use broadcast::BroadcastError;pub use broadcast::BroadcastReceiver;pub use broadcast::BroadcastRecv;pub use broadcast::BroadcastSender;pub use condvar::Condvar;pub use mpsc::Receiver as MpscReceiver;pub use mpsc::Sender as MpscSender;pub use mpsc::channel as mpsc_channel;pub use mutex::Mutex;pub use mutex::MutexGuard;pub use mutex::MutexLockFuture;pub use notify::Notify;pub use notify::NotifyFuture;pub use oneshot::Receiver as OneshotReceiver;pub use oneshot::Sender as OneshotSender;pub use oneshot::channel as oneshot_channel;pub use rwlock::RwLock;pub use rwlock::RwLockReadFuture;pub use rwlock::RwLockWriteFuture;pub use semaphore::Semaphore;pub use semaphore::SemaphoreAcquire;pub use semaphore::SemaphorePermit;pub use watch::Watch;pub use watch::WatchChanged;pub use watch::WatchError;pub use watch::WatchReceiver;pub use watch::WatchSender;
Modules§
- broadcast
- Broadcast channel for one-to-many async communication
- condvar
- Async condition variable.
- mpsc
- Bounded async multi-producer single-consumer channel. Bounded async multi-producer single-consumer channel.
- mutex
- Async mutual-exclusion lock.
- notify
- Notification primitive for efficient async task coordination
- oneshot
- Single-value channel completed by one send.
- rwlock
- Async-aware RwLock for concurrent read/exclusive write access
- semaphore
- Async-aware semaphore for resource limiting
- watch
- Watch channel for state monitoring with change notifications