-
-
Notifications
You must be signed in to change notification settings - Fork 22
feat(cordyceps): Initial support for non-CAS targets #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Would you mind elaborating a bit on the rationale for doing this by For the record, I'm not suggesting that just disabling these APIs on non-CAS platforms is the wrong approach, I'm just curious about why it's the right one. My guess is that this is because |
Yep! That's exactly it. A naiive "drop in p-a" impl would be decidedly not-great for all structures, so my plan was to make the current lib build, notching out unsupported structures entirely, then in a second pass/PR, re-implement at least |
For what it's worth, For bbq2, I ended up making a separate trait for |
Yeah, that makes sense. I'm on board with the initial goal of just getting the crate to build for those targets at all! |
@hawkw is this good to merge, or did you want to take another pass on it? |
sorry, i wanted to leave a few suggestions on the feature-flagging implementation. give me a sec! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a few minor suggestions on how we could make the cfg-gating a bit more ergonomic for future changes to the cfg-gated structures, and a couple small tweaks to the CI job. Other than that, this looks good!
This PR is a first attempt to allow building of
cordyceps
on non-CAS enabled targets, such asthumbv6m-none-eabi
/Cortex-M0+/rp2040.Doing this as a first feature, prior to implementing a non-atomic and
critical_section
based version of TransferStack, in service of embassy-rs/embassy#4035.Rather than making a default-on "CAS" feature, we instead gate on
cfg(target_has_atomic = "ptr")
, which was stabilized in 1.60, which currently has the meaning of "this target has CAS". This automatically gates-outTransferStack
andMpscQueue
, while the "mutable" collections can still be used.Right now the cfg gating is a little scattershot, I wanted to open this to discuss, if you'd like me to clean things up a bit to group the CAS-ful parts, I'm happy to do so.