pub struct FutexMutex<T: ?Sized> { /* private fields */ }Expand description
Move-safe, zero-allocation 3-state futex mutex (0 = unlocked, 1 = locked, 2 = contended).
Implementations§
Source§impl<T> FutexMutex<T>
impl<T> FutexMutex<T>
Sourcepub const fn new(value: T) -> Self
pub const fn new(value: T) -> Self
Creates a new unlocked FutexMutex wrapping value.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the mutex and returns its inner value.
Source§impl<T: ?Sized> FutexMutex<T>
impl<T: ?Sized> FutexMutex<T>
Sourcepub fn try_lock(&self) -> Option<FutexMutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<FutexMutexGuard<'_, T>>
Attempts to acquire the mutex without blocking.
Sourcepub fn lock(&self) -> FutexMutexGuard<'_, T>
pub fn lock(&self) -> FutexMutexGuard<'_, T>
Acquires the mutex, spinning briefly before blocking via futex wait under contention.
Sourcepub unsafe fn raw_unlock(&self)
pub unsafe fn raw_unlock(&self)
Releases the mutex without a guard (used by FutexMutexGuard drop).
§Safety
The caller must currently hold the lock on self and must not access the protected
value after calling raw_unlock without re-acquiring the lock.
Trait Implementations§
impl<T: ?Sized + Send> Send for FutexMutex<T>
impl<T: ?Sized + Send> Sync for FutexMutex<T>
Auto Trait Implementations§
impl<T> !Freeze for FutexMutex<T>
impl<T> !RefUnwindSafe for FutexMutex<T>
impl<T> Forget for FutexMutex<T>where
T: ?Sized,
impl<T> Move for FutexMutex<T>where
T: ?Sized,
impl<T> Unpin for FutexMutex<T>
impl<T> UnsafeUnpin for FutexMutex<T>
impl<T> UnwindSafe for FutexMutex<T>
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