# Struct lock_api::RawReentrantMutex [−] [src]

    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]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

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

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

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

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

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

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

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

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `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.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `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.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.