Struct parking_lot::ArcRwLockWriteGuard
source · pub struct ArcRwLockWriteGuard<R, T>{ /* private fields */ }
Expand description
An RAII rwlock guard returned by the Arc
locking operations on RwLock
.
This is similar to the RwLockWriteGuard
struct, except instead of using a reference to unlock the RwLock
it uses an Arc<RwLock>
. This has several advantages, most notably that it has an 'static
lifetime.
Implementations§
source§impl<R, T> ArcRwLockWriteGuard<R, T>
impl<R, T> ArcRwLockWriteGuard<R, T>
sourcepub fn rwlock(s: &ArcRwLockWriteGuard<R, T>) -> &Arc<RwLock<R, T>>
pub fn rwlock(s: &ArcRwLockWriteGuard<R, T>) -> &Arc<RwLock<R, T>>
Returns a reference to the rwlock, contained in its Arc
.
sourcepub fn unlocked<F, U>(s: &mut ArcRwLockWriteGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked<F, U>(s: &mut ArcRwLockWriteGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
Temporarily unlocks the RwLock
to execute the given function.
This is functionally equivalent to the unlocked
method on RwLockWriteGuard
.
source§impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockDowngrade,
T: ?Sized,
impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockDowngrade,
T: ?Sized,
sourcepub fn downgrade(s: ArcRwLockWriteGuard<R, T>) -> ArcRwLockReadGuard<R, T>
pub fn downgrade(s: ArcRwLockWriteGuard<R, T>) -> ArcRwLockReadGuard<R, T>
Atomically downgrades a write lock into a read lock without allowing any writers to take exclusive access of the lock in the meantime.
This is functionally equivalent to the downgrade
method on RwLockWriteGuard
.
source§impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockUpgradeDowngrade,
T: ?Sized,
impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockUpgradeDowngrade,
T: ?Sized,
sourcepub fn downgrade_to_upgradable(
s: ArcRwLockWriteGuard<R, T>
) -> ArcRwLockUpgradableReadGuard<R, T>
pub fn downgrade_to_upgradable( s: ArcRwLockWriteGuard<R, T> ) -> ArcRwLockUpgradableReadGuard<R, T>
Atomically downgrades a write lock into an upgradable read lock without allowing any writers to take exclusive access of the lock in the meantime.
This is functionally identical to the downgrade_to_upgradable
method on RwLockWriteGuard
.
source§impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockFair,
T: ?Sized,
impl<R, T> ArcRwLockWriteGuard<R, T>where
R: RawRwLockFair,
T: ?Sized,
sourcepub fn unlock_fair(s: ArcRwLockWriteGuard<R, T>)
pub fn unlock_fair(s: ArcRwLockWriteGuard<R, T>)
Unlocks the RwLock
using a fair unlock protocol.
This is functionally equivalent to the unlock_fair
method on RwLockWriteGuard
.
sourcepub fn unlocked_fair<F, U>(s: &mut ArcRwLockWriteGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked_fair<F, U>(s: &mut ArcRwLockWriteGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
Temporarily unlocks the RwLock
to execute the given function.
This is functionally equivalent to the unlocked_fair
method on RwLockWriteGuard
.
sourcepub fn bump(s: &mut ArcRwLockWriteGuard<R, T>)
pub fn bump(s: &mut ArcRwLockWriteGuard<R, T>)
Temporarily yields the RwLock
to a waiting thread if there is one.
This method is functionally equivalent to the bump
method on RwLockWriteGuard
.