[][src]Struct lock_api::RawReentrantMutex

pub struct RawReentrantMutex<R, G> { /* fields omitted */ }

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>[src]

pub const INIT: Self[src]

Initial value for an unlocked mutex.

pub fn lock(&self)[src]

Acquires this mutex, blocking if it's held by another thread.

pub fn try_lock(&self) -> bool[src]

Attempts to acquire this mutex without blocking. Returns true if the lock was successfully acquired and false otherwise.

pub unsafe fn unlock(&self)[src]

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.

pub fn is_locked(&self) -> bool[src]

Checks whether the mutex is currently locked.

impl<R: RawMutexFair, G: GetThreadId> RawReentrantMutex<R, G>[src]

pub unsafe fn unlock_fair(&self)[src]

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.

pub unsafe fn bump(&self)[src]

Temporarily yields the mutex to a waiting thread if there is one.

This method is functionally equivalent to calling unlock_fair followed by lock, 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>[src]

pub fn try_lock_until(&self, timeout: R::Instant) -> bool[src]

Attempts to acquire this lock until a timeout is reached.

pub fn try_lock_for(&self, timeout: R::Duration) -> bool[src]

Attempts to acquire this lock until a timeout is reached.

Trait Implementations

impl<R: RawMutex + Send, G: GetThreadId + Send> Send for RawReentrantMutex<R, G>[src]

impl<R: RawMutex + Sync, G: GetThreadId + Sync> Sync for RawReentrantMutex<R, G>[src]

Auto Trait Implementations

impl<R, G> Unpin for RawReentrantMutex<R, G> where
    G: Unpin,
    R: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.