Struct parking_lot::ArcReentrantMutexGuard
source · pub struct ArcReentrantMutexGuard<R, G, T>{ /* 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, G, T> ArcReentrantMutexGuard<R, G, T>
impl<R, G, T> ArcReentrantMutexGuard<R, G, T>
sourcepub fn remutex(
s: &ArcReentrantMutexGuard<R, G, T>
) -> &Arc<ReentrantMutex<R, G, T>>
pub fn remutex( s: &ArcReentrantMutexGuard<R, G, T> ) -> &Arc<ReentrantMutex<R, G, T>>
Returns a reference to the ReentrantMutex
this object is guarding, contained in its Arc
.
sourcepub fn unlocked<F, U>(s: &mut ArcReentrantMutexGuard<R, G, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked<F, U>(s: &mut ArcReentrantMutexGuard<R, G, T>, f: F) -> Uwhere
F: FnOnce() -> U,
Temporarily unlocks the mutex to execute the given function.
This is safe because &mut
guarantees that there exist no other
references to the data protected by the mutex.
source§impl<R, G, T> ArcReentrantMutexGuard<R, G, T>
impl<R, G, T> ArcReentrantMutexGuard<R, G, T>
sourcepub fn unlock_fair(s: ArcReentrantMutexGuard<R, G, T>)
pub fn unlock_fair(s: ArcReentrantMutexGuard<R, G, T>)
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 ArcReentrantMutexGuard<R, G, T>, f: F) -> Uwhere
F: FnOnce() -> U,
pub fn unlocked_fair<F, U>(s: &mut ArcReentrantMutexGuard<R, G, T>, 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 ArcReentrantMutexGuard<R, G, T>)
pub fn bump(s: &mut ArcReentrantMutexGuard<R, G, T>)
Temporarily yields the mutex to a waiting thread if there is one.
This is functionally equivalent to the bump
method on ReentrantMutexGuard
.