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
.