pub struct RawReentrantMutex<R, G> { /* private fields */ }
Expand description

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

Initial value for an unlocked mutex.

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

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

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.

Checks whether the mutex is currently locked.

Checks whether the mutex is currently held by the current thread.

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.

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.

Attempts to acquire this lock until a timeout is reached.

Attempts to acquire this lock until a timeout is reached.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.