#[repr(C)]pub struct SelfContainedMutex<T> { /* private fields */ }
Expand description
Simple mutex that is suitable for use in shared memory:
- It has a fixed layout (repr(C))
- It’s self-contained; e.g. isn’t boxed and doesn’t refer to global lock-state in this process’s address space.
- Works across processes (e.g. doesn’t use FUTEX_PRIVATE_FLAG)
Performance is optimized primarily for low-contention scenarios.
Implementations§
source§impl<T> SelfContainedMutex<T>
impl<T> SelfContainedMutex<T>
pub const fn const_new(val: T) -> Self
pub fn new(val: T) -> Self
pub fn lock(&self) -> SelfContainedMutexGuard<'_, T>
pub fn lock_pinned<'a>( self: Pin<&'a Self>, ) -> Pin<SelfContainedMutexGuard<'a, T>>
Trait Implementations§
source§impl<T: VirtualAddressSpaceIndependent> VirtualAddressSpaceIndependent for SelfContainedMutex<T>
impl<T: VirtualAddressSpaceIndependent> VirtualAddressSpaceIndependent for SelfContainedMutex<T>
impl<T> Send for SelfContainedMutex<T>where
T: Send,
impl<T> Sync for SelfContainedMutex<T>where
T: Send,
Auto Trait Implementations§
impl<T> !Freeze for SelfContainedMutex<T>
impl<T> !RefUnwindSafe for SelfContainedMutex<T>
impl<T> Unpin for SelfContainedMutex<T>where
T: Unpin,
impl<T> UnwindSafe for SelfContainedMutex<T>where
T: UnwindSafe,
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