Skip to content

spin-based implementation for no_std #61

@matklad

Description

@matklad

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions