atomic_once_cell provides two new types, [AtomicOnceCell] and
[AtomicLazy], which are thread-safe and lock-free versions of
[core::lazy::OnceCell] and [core::lazy::Lazy] suitable for use
in #[no_std] environments.
Blocking
Both types can be used in a non-blocking way, but there are some
blocking calls that should not be used from interrupt handlers or
other contexts where blocking will lead to a deadlock. Blocking is
based on
crossbeam::utils::Backoff,
and will be reduced to a spin lock in #[no_std] environments.
Examples
AtomicOnceCell
use AtomicOnceCell;
static CELL: = new;
AtomicLazy
use AtomicLazy;
static LAZY: = new;