pub struct ArcMutexGuard<R: RawMutex, T: ?Sized> { /* private fields */ }
Available on crate feature
arc_lock
only.Expand description
An RAII mutex guard returned by the Arc
locking operations on Mutex
.
This is similar to the MutexGuard
struct, except instead of using a reference to unlock the Mutex
it
uses an Arc<Mutex>
. This has several advantages, most notably that it has an 'static
lifetime.
Implementations§
Source§impl<R: RawMutex, T: ?Sized> ArcMutexGuard<R, T>
impl<R: RawMutex, T: ?Sized> ArcMutexGuard<R, T>
Source§impl<R: RawMutexFair, T: ?Sized> ArcMutexGuard<R, T>
impl<R: RawMutexFair, T: ?Sized> ArcMutexGuard<R, 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 MutexGuard
.
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 MutexGuard
.
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 identical to the bump
method on MutexGuard
.
Trait Implementations§
impl<R: RawMutex + Send + Sync, T: Send + ?Sized> Send for ArcMutexGuard<R, T>where
R::GuardMarker: Send,
impl<R: RawMutex + Sync, T: Sync + ?Sized> Sync for ArcMutexGuard<R, T>where
R::GuardMarker: Sync,
Auto Trait Implementations§
impl<R, T> Freeze for ArcMutexGuard<R, T>where
T: ?Sized,
impl<R, T> !RefUnwindSafe for ArcMutexGuard<R, T>
impl<R, T> Unpin for ArcMutexGuard<R, T>where
T: ?Sized,
impl<R, T> !UnwindSafe for ArcMutexGuard<R, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more