Skip to main content

Crate noxu_sync

Crate noxu_sync 

Source
Expand description

Noxu DB synchronization primitives.

Futex-based Mutex<T>, RwLock<T>, and Condvar that replace parking_lot throughout the Noxu codebase.

§Extra capabilities vs parking_lot

MethodDescription
Mutex::get_n_waiters()Count of threads blocked waiting for the mutex
Mutex::get_owner()Thread ID hash of the current owner
RwLock::get_n_waiters()Count of threads blocked waiting for the rwlock
RwLock::is_locked_exclusive()Returns true when a write lock is held
RwLock::reader_count()Number of active shared-lock holders (global)

§Drop-in compatibility

The public types are designed to be drop-in replacements for the corresponding parking_lot types:

parking_lot::Mutex<T>          →  noxu_sync::Mutex<T>
parking_lot::RwLock<T>         →  noxu_sync::RwLock<T>
parking_lot::Condvar           →  noxu_sync::Condvar
parking_lot::RawMutex          →  noxu_sync::RawMutex
parking_lot::lock_api::…       →  noxu_sync::lock_api::…
parking_lot::MutexGuard<'_,T>  →  noxu_sync::MutexGuard<'_,T>
parking_lot::WaitTimeoutResult →  noxu_sync::WaitTimeoutResult

Re-exports§

pub use condvar::Condvar;
pub use condvar::WaitTimeoutResult;
pub use raw_mutex::NoxuRawMutex;
pub use raw_rwlock::NoxuRawRwLock;
pub use lock_api;

Modules§

condvar
Futex-based condition variable.
futex
Platform-level futex abstraction.
raw_mutex
Futex-based raw mutex implementing lock_api::RawMutex.
raw_rwlock
Futex-based raw reader-writer lock implementing lock_api::RawRwLock.

Structs§

RwLock
Reader-writer lock backed by a futex.

Type Aliases§

Mutex
Mutual exclusion primitive backed by a futex.
MutexGuard
RAII guard returned by Mutex::lock.
RawMutex
The raw mutex type for direct embed (e.g., log_buffer.rs).
RwLockReadGuard
RAII guard returned by RwLock::read.
RwLockWriteGuard
RAII guard returned by RwLock::write.