Struct lock_api::ArcReentrantMutexGuard
source · pub struct ArcReentrantMutexGuard<R: RawMutex, G: GetThreadId, T: ?Sized> { /* private fields */ }Expand description
An RAII mutex guard returned by the Arc locking operations on ReentrantMutex.
This is similar to the ReentrantMutexGuard struct, except instead of using a reference to unlock the
Mutex it uses an Arc<ReentrantMutex>. This has several advantages, most notably that it has an 'static
lifetime.
Implementations§
source§impl<R: RawMutex, G: GetThreadId, T: ?Sized> ArcReentrantMutexGuard<R, G, T>
impl<R: RawMutex, G: GetThreadId, T: ?Sized> ArcReentrantMutexGuard<R, G, T>
sourcepub fn remutex(s: &Self) -> &Arc<ReentrantMutex<R, G, T>>
pub fn remutex(s: &Self) -> &Arc<ReentrantMutex<R, G, T>>
Returns a reference to the ReentrantMutex this object is guarding, contained in its Arc.
source§impl<R: RawMutexFair, G: GetThreadId, T: ?Sized> ArcReentrantMutexGuard<R, G, T>
impl<R: RawMutexFair, G: GetThreadId, T: ?Sized> ArcReentrantMutexGuard<R, G, T>
sourcepub fn unlock_fair(s: Self)
pub fn unlock_fair(s: Self)
Unlocks the mutex using a fair unlock protocol.
This is functionally identical to the unlock_fair method on ReentrantMutexGuard.
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 mutex to execute the given function.
This is functionally identical to the unlocked_fair method on ReentrantMutexGuard.
sourcepub fn bump(s: &mut Self)
pub fn bump(s: &mut Self)
Temporarily yields the mutex to a waiting thread if there is one.
This is functionally equivalent to the bump method on ReentrantMutexGuard.