Struct RawReentrantMutex
pub struct RawReentrantMutex<R, G> { /* private fields */ }
A raw mutex type that wraps another raw mutex to provide reentrancy.
Although this has the same methods as the RawMutex trait, it does
not implement it, and should not be used in the same way, since this
mutex can successfully acquire a lock multiple times in the same thread.
Only use this when you know you want a raw mutex that can be locked
reentrantly; you probably want ReentrantMutex instead.
Implementations
impl<R: RawMutex, G: GetThreadId> RawReentrantMutex<R, G>
const INIT: Self = _;Initial value for an unlocked mutex.
fn lock(&self)Acquires this mutex, blocking if it's held by another thread.
fn try_lock(&self) -> boolAttempts to acquire this mutex without blocking. Returns
trueif the lock was successfully acquired andfalseotherwise.unsafe fn unlock(&self)Unlocks this mutex. The inner mutex may not be unlocked if this mutex was acquired previously in the current thread.
Safety
This method may only be called if the mutex is held by the current thread.
fn is_locked(&self) -> boolChecks whether the mutex is currently locked.
fn is_owned_by_current_thread(&self) -> boolChecks whether the mutex is currently held by the current thread.
impl<R: RawMutexFair, G: GetThreadId> RawReentrantMutex<R, G>
unsafe fn unlock_fair(&self)Unlocks this mutex using a fair unlock protocol. The inner mutex may not be unlocked if this mutex was acquired previously in the current thread.
Safety
This method may only be called if the mutex is held by the current thread.
unsafe fn bump(&self)Temporarily yields the mutex to a waiting thread if there is one.
This method is functionally equivalent to calling
unlock_fairfollowed bylock, however it can be much more efficient in the case where there are no waiting threads.Safety
This method may only be called if the mutex is held by the current thread.
impl<R: RawMutexTimed, G: GetThreadId> RawReentrantMutex<R, G>
fn try_lock_until(&self, timeout: R::Instant) -> boolAttempts to acquire this lock until a timeout is reached.
fn try_lock_for(&self, timeout: R::Duration) -> boolAttempts to acquire this lock until a timeout is reached.
Trait Implementations
impl<R: RawMutex + Send, G: GetThreadId + Send> Send for RawReentrantMutex<R, G>
impl<R: RawMutex + Sync, G: GetThreadId + Sync> Sync for RawReentrantMutex<R, G>
Auto Trait Implementations
impl<R, G> !Freeze for RawReentrantMutex<R, G>
impl<R, G> !RefUnwindSafe for RawReentrantMutex<R, G>
impl<R, G> Unpin for RawReentrantMutex<R, G>
where
R: Unpin,
G: Unpin,
impl<R, G> UnsafeUnpin for RawReentrantMutex<R, G>
where
R: UnsafeUnpin,
G: UnsafeUnpin,
impl<R, G> UnwindSafe for RawReentrantMutex<R, G>
where
R: UnwindSafe,
G: UnwindSafe,
Blanket Implementations
impl<T> Any for RawReentrantMutex<R, G>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for RawReentrantMutex<R, G>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for RawReentrantMutex<R, G>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for RawReentrantMutex<R, G>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for RawReentrantMutex<R, G>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for RawReentrantMutex<R, G>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for RawReentrantMutex<R, G>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>