Hi, I would like to achieve AtomicRefCell-like behavior on no_std target without CAS support (lots of baseline MCUs like cortex-m0, avr, baseline risc-v). While current implementation is generally no_std friendly, these platforms do not support operations like fetch_add and fetch_sub and compilation fails.
There is a portable-atomic crate ( https://lib.rs/crates/portable-atomic ) (25M monthly downloads) that fills missing CAS operations using platform-dependent implementation (eg. uses CAS where available, uses critical-section where not).
I would like to extend atomic_refcell crate to allow using portable-atomic, based on feature flag (so base implementation will remain unchanged). I would like to ask, whether you are willing to accept a PR adding such functionality and what are your requirements.
My idea was to:
- add portable-atomic feature to this crate, make it disabled by default
- add portable-atomic optional dependency, based on this feature, using library-style features (none)
- replace imports with portable-atomic types, based on feature flag
- bump release version
- adjust docs
Let me know whether this plan looks fine and whether you are open to accept such change.
Hi, I would like to achieve
AtomicRefCell-like behavior onno_stdtarget without CAS support (lots of baseline MCUs like cortex-m0, avr, baseline risc-v). While current implementation is generallyno_stdfriendly, these platforms do not support operations like fetch_add and fetch_sub and compilation fails.There is a portable-atomic crate ( https://lib.rs/crates/portable-atomic ) (25M monthly downloads) that fills missing CAS operations using platform-dependent implementation (eg. uses CAS where available, uses critical-section where not).
I would like to extend
atomic_refcellcrate to allow using portable-atomic, based on feature flag (so base implementation will remain unchanged). I would like to ask, whether you are willing to accept a PR adding such functionality and what are your requirements.My idea was to:
Let me know whether this plan looks fine and whether you are open to accept such change.