Struct parking_lot::ArcRwLockReadGuard
source · pub struct ArcRwLockReadGuard<R, T>{ /* private fields */ }
Expand description
An RAII rwlock guard returned by the Arc
locking operations on RwLock
.
This is similar to the RwLockReadGuard
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> ArcRwLockReadGuard<R, T>
impl<R, T> ArcRwLockReadGuard<R, T>
sourcepub fn rwlock(s: &ArcRwLockReadGuard<R, T>) -> &Arc<RwLock<R, T>>
pub fn rwlock(s: &ArcRwLockReadGuard<R, T>) -> &Arc<RwLock<R, T>>
Returns a reference to the rwlock, contained in its Arc
.
sourcepub fn unlocked<F, U>(s: &mut ArcRwLockReadGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked<F, U>(s: &mut ArcRwLockReadGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
Temporarily unlocks the RwLock
to execute the given function.
This is functionally identical to the unlocked
method on RwLockReadGuard
.
source§impl<R, T> ArcRwLockReadGuard<R, T>where
R: RawRwLockFair,
T: ?Sized,
impl<R, T> ArcRwLockReadGuard<R, T>where
R: RawRwLockFair,
T: ?Sized,
sourcepub fn unlock_fair(s: ArcRwLockReadGuard<R, T>)
pub fn unlock_fair(s: ArcRwLockReadGuard<R, T>)
Unlocks the RwLock
using a fair unlock protocol.
This is functionally identical to the unlock_fair
method on RwLockReadGuard
.
sourcepub fn unlocked_fair<F, U>(s: &mut ArcRwLockReadGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked_fair<F, U>(s: &mut ArcRwLockReadGuard<R, T>, f: F) -> Uwhere
F: FnOnce() -> U,
Temporarily unlocks the RwLock
to execute the given function.
This is functionally identical to the unlocked_fair
method on RwLockReadGuard
.
sourcepub fn bump(s: &mut ArcRwLockReadGuard<R, T>)
pub fn bump(s: &mut ArcRwLockReadGuard<R, T>)
Temporarily yields the RwLock
to a waiting thread if there is one.
This is functionally identical to the bump
method on RwLockReadGuard
.