Mutex

Struct Mutex 

Source
pub struct Mutex(/* private fields */);
Available on crate features dcre and unstable only.
Expand description

An owned mutex.

Deletes the mutex automatically when dropped. The destructor will panic if the deletion fails.

Implementations§

Source§

impl Mutex

Source

pub fn build() -> Builder

acre_mtx: Create a builder for Mutex.

§Examples
use itron::mutex::Mutex;
let mutex = Mutex::build()
    .finish()
    .expect("failed to create a mutex");

mutex.as_ref().lock()
   .expect("failed to perform a lock operation");
mutex.as_ref().unlock()
   .expect("failed to perform a unlock operation");
use itron::mutex::{Mutex, PriorityProtection};
let mutex = Mutex::build()
    .priority_protection(PriorityProtection::Ceiling { priority: 4 })
    .finish()
    .expect("failed to create a priority-ceiling mutex");

mutex.as_ref().lock()
   .expect("failed to perform a lock operation");
mutex.as_ref().unlock()
   .expect("failed to perform a unlock operation");
Source§

impl Mutex

Source

pub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self

Construct a Mutex from a raw object ID.

§Safety

See Object ID Wrappers.

Source

pub const fn leak<'a>(self) -> MutexRef<'a>

Consume and “leak” self, returning a reference MutexRef<'a>.

Source

pub const fn as_raw(&self) -> ID

Get the raw object ID.

Source

pub const fn as_raw_nonnull(&self) -> NonNullID

Get the raw object ID as abi::NonNullID.

Source

pub const fn as_ref(&self) -> MutexRef<'_>

Borrow Mutex as MutexRef.

Use this to perform operations on mutexes because most of the methods are implemented on MutexRef but not Mutex.

Trait Implementations§

Source§

impl Debug for Mutex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Mutex

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Mutex

Source§

fn eq(&self, other: &Mutex) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Mutex

Source§

impl StructuralPartialEq for Mutex

Auto Trait Implementations§

§

impl Freeze for Mutex

§

impl RefUnwindSafe for Mutex

§

impl Send for Mutex

§

impl Sync for Mutex

§

impl Unpin for Mutex

§

impl UnwindSafe for Mutex

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> Unknown for T
where T: ?Sized,