Struct lock_api::ArcRwLockReadGuard
source · pub struct ArcRwLockReadGuard<R: RawRwLock, T: ?Sized> { /* private fields */ }
arc_lock
only.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: RawRwLock, T: ?Sized> ArcRwLockReadGuard<R, T>
impl<R: RawRwLock, T: ?Sized> ArcRwLockReadGuard<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 identical to the unlocked
method on RwLockReadGuard
.
source§impl<R: RawRwLockFair, T: ?Sized> ArcRwLockReadGuard<R, T>
impl<R: RawRwLockFair, T: ?Sized> ArcRwLockReadGuard<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 identical to the unlock_fair
method on RwLockReadGuard
.
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 identical to the unlocked_fair
method on RwLockReadGuard
.
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 is functionally identical to the bump
method on RwLockReadGuard
.