Skip to main content

Module sync

Module sync 

Source
Expand description

Simple synchronization primitives (SpinLock, Once) for no_std environments. Minimal synchronization primitives for no_std kernels.

These primitives are intentionally simple and are meant as building blocks. They are not a full-featured synchronization library.

§Important caveats

  • No fairness guarantees: spin locks may starve.
  • Not preemption-safe by themselves: if your kernel is preemptive or can be interrupted, you may need to disable interrupts or otherwise ensure lock-holding sections are safe.
  • Single-core vs multi-core: on SMP systems, these use atomics and are safe provided your platform’s memory model matches Rust’s atomic semantics.

Structs§

Once
A minimal, spin-based Once initializer.
SpinLock
A simple spin lock.
SpinLockGuard
RAII guard returned by SpinLock::lock.