-
Notifications
You must be signed in to change notification settings - Fork 290
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
Add feature to support platforms without atomic CAS #467
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Any reason this is still just a draft? |
0a2e648
to
1e0640f
Compare
Adopt the third idea of tokio-rs#573 (comment).
1e0640f
to
2be8c5e
Compare
This provides a better error message if the end user forgets to use the cfg or feature.
@Darksonn you seem to be the most active reviewer on this crate based on the latest commits. Could you provide some light regarding the status of this PR? What is blocking it from being merged? What comes to mind would be:
|
Taking new dependencies is always complicated. It raises various questions about to what extent we lock ourselves in for the future, what effect it has on MSRV and so on. I also see that there's another PR that uses a different crate for atomics, and I'll need to understand what happened there. I see that there's a bunch of discussion on the other PR. Other than that, sometimes what a PR needs is just to ping someone and spur them to action. I'm at a conference right now, but I can try to take a look when I fly back to Europe (if I find the energy to look at my laptop during the flight). |
Makes sense, let me try to give you some pointers in that regard, so you don't spend too much time doing archaeology.
Even though #573 is more recent and has more discussions, those discussions are reflected in this PR. The main point of contention as I see it (anyone correct me if I'm wrong) is how
So my understanding would be that
No worries, I was just checking. Good luck at the conference! |
Should a new PR be opened? Possibly with a smaller diff such that it's easier to review? |
Sorry, I never got around to it. I'm happy to accept this feature, with the following changes:
Also, the merge conflicts will need to be fixed. |
@Darksonn I'm pleased that things still seem to be moving forward here. :) @taiki-e: What is your current capacity? We (me or @HusseinAbdelhamid) could offer to support here and solve the last two changes, including merge conflicts. |
Some no-std targets (e.g., ARMv6-M) do not support atomic CAS operations and cannot use
Arc
,Atomic*::compare_exchange
, etc. And on those targets, bytes currently fails to build (#461).EDIT: This PR has been updated to adopt the third idea of #573 (comment).
The latest version of this PR uses portable-atomic to support platforms without atomic CAS.
This currently uses the feature name ("extra-platforms") mentioned by carllerche in #461 (comment).
old version
This patch detects those targets using the
TARGET
environment variables provided by cargo for the build script, and a list of targets that do not support atomic CAS operations.This way is the same as the way we recently adopted in futures and valuable, and was originally inspired by the way heapless and defmt do, but this doesn't maintain the target list manually. (It's not really fully automated, but it's very easy to update.)
Refs:
Closes #461
Closes #573