Skip to main content

SpinRwLock

Struct SpinRwLock 

Source
pub struct SpinRwLock<T>
where T: ?Sized,
{ /* private fields */ }
Expand description

A preemptible RT reader/writer lock with a single-writer PI gate.

Readers already holding the lock cannot receive a writer’s donation. Each successful guard pins migration but leaves hardware IRQs enabled.

Implementations§

Source§

impl<T> SpinRwLock<T>

Source

pub const fn new(value: T) -> SpinRwLock<T>

Creates an unlocked RT read/write lock.

Source

pub fn into_inner(self) -> T

Returns the protected value through exclusive object ownership.

Source§

impl<T> SpinRwLock<T>
where T: ?Sized,

Source

pub fn read(&self) -> SpinRwLockReadGuard<'_, T>

Acquires shared access in preemptible task context.

Source

pub fn write(&self) -> SpinRwLockWriteGuard<'_, T>

Acquires exclusive access, waiting for existing readers to finish.

Source

pub fn try_read(&self) -> Option<SpinRwLockReadGuard<'_, T>>

Attempts shared access without sleeping.

Source

pub fn try_write(&self) -> Option<SpinRwLockWriteGuard<'_, T>>

Attempts exclusive access without sleeping.

Source

pub fn read_irqsave(&self) -> SpinRwLockReadGuard<'_, T>

RT IRQ-save spelling; hardware IRQ state remains unchanged.

Source

pub fn write_irqsave(&self) -> SpinRwLockWriteGuard<'_, T>

RT IRQ-save spelling; hardware IRQ state remains unchanged.

Source

pub fn try_read_irqsave(&self) -> Option<SpinRwLockReadGuard<'_, T>>

RT IRQ-save spelling; hardware IRQ state remains unchanged.

Source

pub fn try_write_irqsave(&self) -> Option<SpinRwLockWriteGuard<'_, T>>

RT IRQ-save spelling; hardware IRQ state remains unchanged.

Source

pub fn get_mut(&mut self) -> &mut T

Returns exclusive access without locking.

Trait Implementations§

Source§

impl<T> Debug for SpinRwLock<T>
where T: Debug + ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Default for SpinRwLock<T>
where T: Default,

Source§

fn default() -> SpinRwLock<T>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for SpinRwLock<T>

§

impl<T> !RefUnwindSafe for SpinRwLock<T>

§

impl<T> !UnwindSafe for SpinRwLock<T>

§

impl<T> Send for SpinRwLock<T>
where RwLock<RawRwSemaphore, T>: Send, T: ?Sized,

§

impl<T> Sync for SpinRwLock<T>
where RwLock<RawRwSemaphore, T>: Sync, T: ?Sized,

§

impl<T> Unpin for SpinRwLock<T>
where RwLock<RawRwSemaphore, T>: Unpin, T: ?Sized,

§

impl<T> UnsafeUnpin for SpinRwLock<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.