#[repr(C, align(16))]pub struct Spinlock { /* private fields */ }Expand description
A blocking cross core lock to guarantee mutual exclusive access. While this lock might block other cores to continue processing this lock should be held as short as possible. Also care shall be taken while using this lock within interrupt handlers, as this might lead to deadlock situations if the lock holding core is interrupted and the interrupt is also trying to aquire the same lock.
Implementations§
Source§impl Spinlock
impl Spinlock
Sourcepub const fn new() -> Spinlock
pub const fn new() -> Spinlock
Create a new Spinlock. To ensure it is shared between cores, it’s typically assigned to a static variable
§Example
static LOCK: Spinlock = Spinlock::new();Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Spinlock
impl RefUnwindSafe for Spinlock
impl Send for Spinlock
impl Sync for Spinlock
impl Unpin for Spinlock
impl UnwindSafe for Spinlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more