Replace spin with critical-section for no_std sync
#36
loadingalias
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm thinking about replacing the
spindep w/critical-sectionforno_stdsynchronization needs.While I was working on the
no_stdbuild fix (#34), I noticed thatspinrequires platform atomics that aren't available on all embedded targets (e.g., Cortex-M0). The current fix makesspintarget-conditional, which works, but I wanted to float a potentially more robust long-term approach to no_std/wasm usage.My idea is to basically replace
spinwithcritical-sectionbased sync primitives. This is the standard approach in the Rust embedded ecosystem and would:no_stdtargetscritical-sectioncrateIt wouldn't come w/o a few trade-offs. We'd have the extra dep
critical-sectionwhen I feel like we're trying to move in the opposite direction? Maybe I'm wrong here, but I'm under the impression we're aiming to reduce the deps. We'd also have the slight API differences fromspinbut it would ship as a major bump anyway.I'm not suggesting this NEEDS to happen; I guess I just wanted to share the thought? I feel like we could do better w/ respect to no_std... and kind of think beyond being 'compatible' and more to 'awesome to use'. IDK.
Thoughts @onethumb?
Beta Was this translation helpful? Give feedback.
All reactions