pub struct RawThreadMutex<R: RawMutex, G: GetThreadId> { /* private fields */ }
Expand description

A mutex type that knows when it would deadlock

Implementations§

source§

impl<R: RawMutex, G: GetThreadId> RawThreadMutex<R, G>

source

pub const INIT: Self = _

source

pub fn lock(&self) -> bool

Blocks for the mutex to be available, and returns true if the mutex isn’t already locked on the current thread.

source

pub fn try_lock(&self) -> Option<bool>

Returns Some(true) if able to successfully lock without blocking, Some(false) otherwise, and None when the mutex is already locked on the current thread.

source

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.

Trait Implementations§

Auto Trait Implementations§

§

impl<R, G> RefUnwindSafe for RawThreadMutex<R, G>where G: RefUnwindSafe, R: RefUnwindSafe,

§

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

§

impl<R, G> UnwindSafe for RawThreadMutex<R, G>where G: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> ExactFrom<T> for Uwhere U: TryFrom<T>,

source§

fn exact_from(value: T) -> U

source§

impl<T, U> ExactInto<U> for Twhere U: ExactFrom<T>,

source§

fn exact_into(self) -> U

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> OverflowingInto<U> for Twhere U: OverflowingFrom<T>,

source§

impl<T, U> RoundingInto<U> for Twhere U: RoundingFrom<T>,

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> SaturatingInto<U> for Twhere U: SaturatingFrom<T>,

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T, U> WrappingInto<U> for Twhere U: WrappingFrom<T>,

source§

fn wrapping_into(self) -> U