Skip to content

Replace the use of std::sync::Once with no_std-compatible code #745

@briansmith

Description

@briansmith

See #744. One of the two pain ports in porting ring to a no_std platform is our use of std::sync::Once, which (obviously) requires libstd. There is only one use of std::sync::Once. Our single use of std::sync::Once is very simple: We look up the CPU capabilities (e.g. using CPUID) and store the results.

I think it is safe to assume that looking up the CPU capabilities is idempotent, so we could probably even let threads race with each other to cache the CPU capabilities, letting them stomp on each other's caching (in a controlled way).

/cc @jethrogb

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