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
.