Struct lock_api::ArcRwLockWriteGuard
source · pub struct ArcRwLockWriteGuard<R: RawRwLock, T: ?Sized> { /* 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: RawRwLock, T: ?Sized> ArcRwLockWriteGuard<R, T>
impl<R: RawRwLock, T: ?Sized> ArcRwLockWriteGuard<R, T>
sourcepub fn rwlock(s: &Self) -> &Arc<RwLock<R, T>>
pub fn rwlock(s: &Self) -> &Arc<RwLock<R, T>>
Returns a reference to the rwlock, contained in its Arc.
sourcepub fn unlocked<F, U>(s: &mut Self, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked<F, U>(s: &mut Self, 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: RawRwLockDowngrade, T: ?Sized> ArcRwLockWriteGuard<R, T>
impl<R: RawRwLockDowngrade, T: ?Sized> ArcRwLockWriteGuard<R, T>
sourcepub fn downgrade(s: Self) -> ArcRwLockReadGuard<R, T>
pub fn downgrade(s: Self) -> 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: RawRwLockUpgradeDowngrade, T: ?Sized> ArcRwLockWriteGuard<R, T>
impl<R: RawRwLockUpgradeDowngrade, T: ?Sized> ArcRwLockWriteGuard<R, T>
sourcepub fn downgrade_to_upgradable(s: Self) -> ArcRwLockUpgradableReadGuard<R, T>
pub fn downgrade_to_upgradable(s: Self) -> 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: RawRwLockFair, T: ?Sized> ArcRwLockWriteGuard<R, T>
impl<R: RawRwLockFair, T: ?Sized> ArcRwLockWriteGuard<R, T>
sourcepub fn unlock_fair(s: Self)
pub fn unlock_fair(s: Self)
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 Self, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked_fair<F, U>(s: &mut Self, 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 Self)
pub fn bump(s: &mut Self)
Temporarily yields the RwLock to a waiting thread if there is one.
This method is functionally equivalent to the bump method on RwLockWriteGuard.