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 into_arc(s: Self) -> Arc<RwLock<R, T>>
pub fn into_arc(s: Self) -> Arc<RwLock<R, T>>
Unlocks the RwLock and returns the Arc that was held by the ArcRwLockWriteGuard.
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 into_arc_fair(s: Self) -> Arc<RwLock<R, T>>
pub fn into_arc_fair(s: Self) -> Arc<RwLock<R, T>>
Unlocks the RwLock using a fair unlock protocol and returns the Arc that was held by the ArcRwLockWriteGuard.
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.