Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 54a9412

Browse files
committed
Export guard types for locks, redefine Mutex, export ReentrantMutex
1 parent 9190a8a commit 54a9412

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

liblumen_core/src/locks.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ use core::sync::atomic::{AtomicBool, Ordering};
33

44
use lock_api::{GuardSend, RawMutex};
55

6+
/// A standard mutex
7+
/// See docs for `parking_lot::Mutex<T>` for details
8+
pub type Mutex<T> = parking_lot::Mutex<T>;
9+
pub type MutexGuard<'a, T> = parking_lot::MutexGuard<'a, T>;
10+
611
/// A re-entrant mutex.
712
/// See docs for `parking_lot::ReentrantMutex<T>` for details
8-
pub type Mutex<T> = parking_lot::ReentrantMutex<T>;
13+
pub type ReentrantMutex<T> = parking_lot::ReentrantMutex<T>;
14+
pub type ReentrantMutexGuard<'a, T> = parking_lot::ReentrantMutexGuard<'a, T>;
915

1016
/// A condition variable
1117
/// See docs for `parking_lot::Condvar` for details
@@ -14,6 +20,9 @@ pub type Condvar = parking_lot::Condvar;
1420
/// A read/write lock
1521
/// See docs for `parking_lot::RwLock<T>` for details
1622
pub type RwLock<T> = parking_lot::RwLock<T>;
23+
pub type RwLockReadGuard<'a, T> = parking_lot::RwLockReadGuard<'a, T>;
24+
pub type RwLockWriteGuard<'a, T> = parking_lot::RwLockWriteGuard<'a, T>;
25+
pub type RwLockUpgradeableReadGuard<'a, T> = parking_lot::RwLockUpgradableReadGuard<'a, T>;
1726

1827
/// Used for simple spinlocks, for locking values, use one of the other mutex types
1928
/// See `lock_api::Mutex<T, U>` for details.

0 commit comments

Comments
 (0)