pub struct RawSpinRwLock<T>(/* private fields */)
where
T: ?Sized;Expand description
A non-sleeping read-write lock with acquisition-site context policy.
Implementations§
Source§impl<T> RawSpinRwLock<T>
impl<T> RawSpinRwLock<T>
Sourcepub const fn new(data: T) -> RawSpinRwLock<T>
pub const fn new(data: T) -> RawSpinRwLock<T>
Creates an unlocked spin read-write lock.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the lock and returns the protected value.
Source§impl<T> RawSpinRwLock<T>where
T: ?Sized,
impl<T> RawSpinRwLock<T>where
T: ?Sized,
Sourcepub fn read(&self) -> BaseSpinRwLockReadGuard<'_, PreemptState, T>
pub fn read(&self) -> BaseSpinRwLockReadGuard<'_, PreemptState, T>
Acquires a read guard after disabling preemption.
Sourcepub fn try_read(&self) -> Option<BaseSpinRwLockReadGuard<'_, PreemptState, T>>
pub fn try_read(&self) -> Option<BaseSpinRwLockReadGuard<'_, PreemptState, T>>
Attempts a read acquisition after disabling preemption.
Sourcepub fn write(&self) -> BaseSpinRwLockWriteGuard<'_, PreemptState, T>
pub fn write(&self) -> BaseSpinRwLockWriteGuard<'_, PreemptState, T>
Acquires a write guard after disabling preemption.
Sourcepub fn try_write(&self) -> Option<BaseSpinRwLockWriteGuard<'_, PreemptState, T>>
pub fn try_write(&self) -> Option<BaseSpinRwLockWriteGuard<'_, PreemptState, T>>
Attempts a write acquisition after disabling preemption.
Sourcepub fn read_irqsave(
&self,
) -> BaseSpinRwLockReadGuard<'_, PreemptIrqSaveState, T>
pub fn read_irqsave( &self, ) -> BaseSpinRwLockReadGuard<'_, PreemptIrqSaveState, T>
Acquires an IRQ-save read guard.
Sourcepub fn try_read_irqsave(
&self,
) -> Option<BaseSpinRwLockReadGuard<'_, PreemptIrqSaveState, T>>
pub fn try_read_irqsave( &self, ) -> Option<BaseSpinRwLockReadGuard<'_, PreemptIrqSaveState, T>>
Attempts an IRQ-save read acquisition.
Sourcepub fn write_irqsave(
&self,
) -> BaseSpinRwLockWriteGuard<'_, PreemptIrqSaveState, T>
pub fn write_irqsave( &self, ) -> BaseSpinRwLockWriteGuard<'_, PreemptIrqSaveState, T>
Acquires an IRQ-save write guard.
Sourcepub fn try_write_irqsave(
&self,
) -> Option<BaseSpinRwLockWriteGuard<'_, PreemptIrqSaveState, T>>
pub fn try_write_irqsave( &self, ) -> Option<BaseSpinRwLockWriteGuard<'_, PreemptIrqSaveState, T>>
Attempts an IRQ-save write acquisition.
Sourcepub unsafe fn read_raw(&self) -> BaseSpinRwLockReadGuard<'_, RawState, T>
pub unsafe fn read_raw(&self) -> BaseSpinRwLockReadGuard<'_, RawState, T>
Acquires a raw read guard without changing execution context.
§Safety
The caller must prevent re-entry and uphold the read-side exclusion contract, including on single-core builds.
Sourcepub unsafe fn try_read_raw(
&self,
) -> Option<BaseSpinRwLockReadGuard<'_, RawState, T>>
pub unsafe fn try_read_raw( &self, ) -> Option<BaseSpinRwLockReadGuard<'_, RawState, T>>
Sourcepub unsafe fn write_raw(&self) -> BaseSpinRwLockWriteGuard<'_, RawState, T>
pub unsafe fn write_raw(&self) -> BaseSpinRwLockWriteGuard<'_, RawState, T>
Acquires a raw write guard without changing execution context.
§Safety
The caller must prevent re-entry and concurrent readers or writers, including on single-core builds.