pub trait BareSpinLock: Send + Sync {
type Guard<'a>
where Self: 'a;
const NEW: Self;
// Required methods
fn try_lock(&self) -> Option<Self::Guard<'_>>;
unsafe fn adopt_locked(
&self,
interrupts_on_drop: InterruptsOnDrop,
) -> Self::Guard<'_>;
// Provided method
fn lock(&self) -> Self::Guard<'_> { ... }
}Required Associated Constants§
Required Associated Types§
Required Methods§
fn try_lock(&self) -> Option<Self::Guard<'_>>
Sourceunsafe fn adopt_locked(
&self,
interrupts_on_drop: InterruptsOnDrop,
) -> Self::Guard<'_>
unsafe fn adopt_locked( &self, interrupts_on_drop: InterruptsOnDrop, ) -> Self::Guard<'_>
Reconstructs a guard for a lock that is already held by the current core (for example, when lock ownership is transferred across a context switch into a newly started thread’s entry trampoline).
Do not call directly.
interrupts_on_drop controls whether dropping the returned guard will
re-enable interrupts after unlocking (InterruptsOnDrop::Restore) or
leave interrupts disabled (InterruptsOnDrop::KeepDisabled).
§Safety
The caller must guarantee that the lock is currently held, interrupts are
disabled, and no other active Guard will unlock it. See
SpinLock::adopt_locked() for use and safety information.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".