Struct maitake_sync::spin::Spinlock
source · pub struct Spinlock { /* private fields */ }
Expand description
A spinlock-based RawMutex
implementation.
This mutex will spin with an exponential backoff while waiting for the lock to become available.
This type implements the RawMutex
and
ScopedRawMutex
traits from the
[mutex-traits
] crate. This allows it to be used with the
blocking::Mutex
type when a spinlock-based mutex is needed.
Implementations§
Trait Implementations§
source§impl RawMutex for Spinlock
impl RawMutex for Spinlock
§type GuardMarker = ()
type GuardMarker = ()
Marker type which determines whether a lock guard should be
Send
.source§fn lock(&self)
fn lock(&self)
Acquires this mutex, blocking the current thread/CPU core until it is
able to do so.
Auto Trait Implementations§
impl RefUnwindSafe for Spinlock
impl Send for Spinlock
impl Sync for Spinlock
impl Unpin for Spinlock
impl UnwindSafe for Spinlock
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<M> ScopedRawMutex for Mwhere
M: RawMutex,
impl<M> ScopedRawMutex for Mwhere
M: RawMutex,
§fn try_with_lock<R>(&self, f: impl FnOnce() -> R) -> Option<R>
fn try_with_lock<R>(&self, f: impl FnOnce() -> R) -> Option<R>
Lock this
ScopedRawMutex
, calling f()
after the lock has been acquired, and releasing
the lock after the completion of f()
. Read more