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
impl Mutex
Sourcepub fn build() -> Builder
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
impl Mutex
Sourcepub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self
pub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self
Sourcepub const fn leak<'a>(self) -> MutexRef<'a>
pub const fn leak<'a>(self) -> MutexRef<'a>
Consume and “leak” self, returning a reference MutexRef<'a>.
Sourcepub const fn as_raw_nonnull(&self) -> NonNullID
pub const fn as_raw_nonnull(&self) -> NonNullID
Get the raw object ID as abi::NonNullID.
Trait Implementations§
impl Eq for Mutex
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> 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
Mutably borrows from an owned value. Read more