citadel_io/standard/
locks.rs

1//! Native platform synchronization primitives using parking_lot.
2//!
3//! This module provides high-performance synchronization primitives for native platforms
4//! by re-exporting parking_lot's implementations. These primitives are more efficient
5//! than the standard library's synchronization types.
6
7/// A mutual exclusion primitive useful for protecting shared data.
8/// Re-exported from parking_lot for better performance.
9pub type Mutex<T> = parking_lot::Mutex<T>;
10
11/// RAII guard for a mutex. The data protected by the mutex can be accessed
12/// through this guard. The lock is automatically released when the guard is dropped.
13pub type MutexGuard<'a, T> = parking_lot::MutexGuard<'a, T>;
14
15/// A reader-writer lock, allowing multiple readers or a single writer at any point in time.
16/// Re-exported from parking_lot for better performance.
17pub type RwLock<T> = parking_lot::RwLock<T>;
18
19/// RAII guard for read access to an RwLock. Multiple read guards can exist at the same time.
20pub type RwLockReadGuard<'a, T> = parking_lot::RwLockReadGuard<'a, T>;
21
22/// RAII guard for write access to an RwLock. Only one write guard can exist at a time.
23pub type RwLockWriteGuard<'a, T> = parking_lot::RwLockWriteGuard<'a, T>;