pub struct SpinLock<K: Kernel, T> {
data: UnsafeCell<T>,
inner: K::BareSpinLock,
}Fields§
§data: UnsafeCell<T>§inner: K::BareSpinLockImplementations§
Source§impl<K: Kernel, T> SpinLock<K, T>
impl<K: Kernel, T> SpinLock<K, T>
pub const fn new(initial_value: T) -> Self
pub fn try_lock(&self, kernel: K) -> Option<SpinLockGuard<'_, K, T>>
pub fn lock(&self, kernel: K) -> SpinLockGuard<'_, K, T>
Sourcepub unsafe fn adopt_locked(
&self,
kernel: K,
interrupts_on_drop: InterruptsOnDrop,
) -> SpinLockGuard<'_, K, T>
pub unsafe fn adopt_locked( &self, kernel: K, interrupts_on_drop: InterruptsOnDrop, ) -> SpinLockGuard<'_, K, T>
Reconstructs a SpinLockGuard for a lock that is already held and whose
ownership was transferred to the calling context (for example, across a
context switch into a newly started thread).
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 underlying lock is currently held,
interrupts and preemption are disabled (preempt_disable_count >= 1),
and no other active guard exists for this lock.