pub struct RawSpinLock<T: ?Sized>(/* private fields */);Expand description
A non-sleeping mutual-exclusion lock.
The lock object does not bake in an execution-context policy. Callers
choose the policy at the acquisition site with Self::lock,
Self::lock_irqsave, or Self::lock_raw.
Implementations§
Source§impl<T> RawSpinLock<T>
impl<T> RawSpinLock<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the lock and returns the protected value.
Source§impl<T: ?Sized> RawSpinLock<T>
impl<T: ?Sized> RawSpinLock<T>
Sourcepub fn lock(&self) -> RawSpinLockGuard<'_, T>
pub fn lock(&self) -> RawSpinLockGuard<'_, T>
Acquires the lock after disabling kernel preemption.
Sourcepub fn lock_nested(&self, subclass: u32) -> RawSpinLockGuard<'_, T>
pub fn lock_nested(&self, subclass: u32) -> RawSpinLockGuard<'_, T>
Acquires the lock after disabling preemption, using a lockdep subclass.
This is intended for structurally nested acquisitions of different
locks with the same class. Without lockdep, subclass has no effect.
Sourcepub fn try_lock(&self) -> Option<RawSpinLockGuard<'_, T>>
pub fn try_lock(&self) -> Option<RawSpinLockGuard<'_, T>>
Attempts to acquire the lock after disabling kernel preemption.
Sourcepub fn lock_irqsave(&self) -> RawSpinLockIrqSaveGuard<'_, T>
pub fn lock_irqsave(&self) -> RawSpinLockIrqSaveGuard<'_, T>
Acquires the lock after disabling preemption and saving/disabling IRQs.
Sourcepub fn lock_irqsave_nested(
&self,
subclass: u32,
) -> RawSpinLockIrqSaveGuard<'_, T>
pub fn lock_irqsave_nested( &self, subclass: u32, ) -> RawSpinLockIrqSaveGuard<'_, T>
Acquires the lock after disabling preemption and saving/disabling IRQs, using a lockdep subclass.
This is intended for structurally nested acquisitions of different
locks with the same class. Without lockdep, subclass has no effect.
Sourcepub fn try_lock_irqsave(&self) -> Option<RawSpinLockIrqSaveGuard<'_, T>>
pub fn try_lock_irqsave(&self) -> Option<RawSpinLockIrqSaveGuard<'_, T>>
Attempts to acquire the lock after disabling preemption and IRQs.
Sourcepub unsafe fn lock_raw(&self) -> RawSpinLockUnpinnedGuard<'_, T>
pub unsafe fn lock_raw(&self) -> RawSpinLockUnpinnedGuard<'_, T>
Acquires the lock without changing preemption or interrupt state.
§Safety
The caller must prevent same-CPU re-entry and all concurrent access which could violate exclusive access, including on single-core builds where the atomic lock word is compiled out.
Sourcepub unsafe fn try_lock_raw(&self) -> Option<RawSpinLockUnpinnedGuard<'_, T>>
pub unsafe fn try_lock_raw(&self) -> Option<RawSpinLockUnpinnedGuard<'_, T>>
Attempts a raw acquisition without changing execution context.
§Safety
The caller must uphold the same exclusion contract as
Self::lock_raw, even when this function returns None.