pub struct SpinLock<T> { /* private fields */ }Expand description
A simple spinlock
Implementations§
Source§impl<T> SpinLock<T>
impl<T> SpinLock<T>
Sourcepub fn lock(&self) -> SpinLockGuard<'_, T>
pub fn lock(&self) -> SpinLockGuard<'_, T>
Acquire the lock, spinning until it’s available
Sourcepub fn try_lock(&self) -> Option<SpinLockGuard<'_, T>>
pub fn try_lock(&self) -> Option<SpinLockGuard<'_, T>>
Try to acquire the lock without spinning.
Sourcepub fn try_lock_no_irqsave(&self) -> Option<SpinLockGuard<'_, T>>
pub fn try_lock_no_irqsave(&self) -> Option<SpinLockGuard<'_, T>>
Try to acquire the lock without touching interrupt flags.
Returns None if IRQs are currently enabled (i.e. no IrqDisabledToken
can be constructed) or if the lock is already held.
Caller must ensure IRQs remain disabled for the lifetime of the guard.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for SpinLock<T>
impl<T> !RefUnwindSafe for SpinLock<T>
impl<T> Unpin for SpinLock<T>where
T: Unpin,
impl<T> UnsafeUnpin for SpinLock<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SpinLock<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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more