embedded_mutex
A minimal, no_std
-friendly, non-blocking mutex for embedded Rust.
EmbeddedMutex<T>
provides a very lightweight mutual exclusion primitive
for no_std
environments where you want to avoid blocking and have full
control over when the lock is released.
⚠ Safety notice: This is a low-level primitive. The try_get
method is
unsafe
because it hands out a &mut T
without tying its lifetime to a guard.
You must manually release the lock by calling return_mutex
once you are done.
Features
#![no_std]
compatible- Non-blocking
try_get
acquisition - Minimal atomic-based implementation
- Works in bare-metal and embedded contexts
- Zero allocations
Example
use EmbeddedMutex;
static MY_MUTEX: = new;