We currently don't provide sync module in no_std, as it requires OS-level support for blocking. What lazy_static does in this case is that it has a spin feature, which replaces locking with spinning.
I think just silently replacing OS mutexes with busy waiting is the wrong approach, this is an important distinction which should be reflected in the type system.
So, we should instead add an opt-in spin module, which has the same API as sync, but is based on the spin crate. That is, with both std and spin features enabled, the user should be able to use both once_cell::sync and once_cell::spin.
We currently don't provide
syncmodule in no_std, as it requires OS-level support for blocking. What lazy_static does in this case is that it has aspinfeature, which replaces locking with spinning.I think just silently replacing OS mutexes with busy waiting is the wrong approach, this is an important distinction which should be reflected in the type system.
So, we should instead add an opt-in
spinmodule, which has the same API assync, but is based on thespincrate. That is, with bothstdandspinfeatures enabled, the user should be able to use bothonce_cell::syncandonce_cell::spin.