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§
Source§impl<R, G> RawReentrantMutex<R, G>where
R: RawMutex,
G: GetThreadId,
impl<R, G> RawReentrantMutex<R, G>where
R: RawMutex,
G: GetThreadId,
Sourcepub const INIT: RawReentrantMutex<R, G>
pub const INIT: RawReentrantMutex<R, G>
Initial value for an unlocked mutex.
Sourcepub fn try_lock(&self) -> bool
pub fn try_lock(&self) -> bool
Attempts to acquire this mutex without blocking. Returns true
if the lock was successfully acquired and false otherwise.
Sourcepub unsafe fn unlock(&self)
pub 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.
Sourcepub fn is_owned_by_current_thread(&self) -> bool
pub fn is_owned_by_current_thread(&self) -> bool
Checks whether the mutex is currently held by the current thread.
Source§impl<R, G> RawReentrantMutex<R, G>where
R: RawMutexFair,
G: GetThreadId,
impl<R, G> RawReentrantMutex<R, G>where
R: RawMutexFair,
G: GetThreadId,
Sourcepub unsafe fn unlock_fair(&self)
pub 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.
Sourcepub unsafe fn bump(&self)
pub unsafe fn bump(&self)
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.
Source§impl<R, G> RawReentrantMutex<R, G>where
R: RawMutexTimed,
G: GetThreadId,
impl<R, G> RawReentrantMutex<R, G>where
R: RawMutexTimed,
G: GetThreadId,
Sourcepub fn try_lock_until(&self, timeout: <R as RawMutexTimed>::Instant) -> bool
pub fn try_lock_until(&self, timeout: <R as RawMutexTimed>::Instant) -> bool
Attempts to acquire this lock until a timeout is reached.
Sourcepub fn try_lock_for(&self, timeout: <R as RawMutexTimed>::Duration) -> bool
pub fn try_lock_for(&self, timeout: <R as RawMutexTimed>::Duration) -> bool
Attempts to acquire this lock until a timeout is reached.
Trait Implementations§
impl<R, G> Send for RawReentrantMutex<R, G>
impl<R, G> 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>
impl<R, G> UnwindSafe for RawReentrantMutex<R, G>where
R: UnwindSafe,
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.