Skip to content
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

Use portable-atomic only for 32-bit architectures #347

Closed

Conversation

repi
Copy link

@repi repi commented Mar 11, 2023

A new take on how to use the atomics without bringing in the portable-atomic crate for 64-bit architectures where one can use just std.

Believe this approach could satisfy the requirements, and be easier to use for everyone, but I'm not super familiar with this crate so may have missed something also.

Resolves #346
Resolves #323

Changed

  • Only use portable_atomic::AtomicU64 for 32-bit platforms, for 64-bit platforms use std.

Added

  • Re-export AtomicU64 so one have an easy and convenient way to get the used atomic counter type regardless if one 32-bit or 64-bit architectures and without depending on external crates when using this crate.

Removed

  • Removed the std-atomics Cargo feature as it is not longer needed

@tobz
Copy link
Member

tobz commented Apr 15, 2023

I ended up replicating this by hand in a3a706b as I wanted to slightly tweak some things. I'm going to close this PR with that in mind, but I did make sure to credit you for that change in the CHANGELOG, as it ultimately overlapped with your diff by nearly 100%.

Thanks again for your contribution and kicking my butt to get this solved in a cleaner way.

@tobz tobz closed this Apr 15, 2023
@tobz tobz added C-util Component: utility classes and helpers. C-core Component: core functionality such as traits, etc. E-simple Effort: simple. T-refactor Type: refactor. S-awaiting-release Status: awaiting a release to be considered fixed/implemented. labels Apr 15, 2023
@repi
Copy link
Author

repi commented Apr 16, 2023

thanks!

@tobz
Copy link
Member

tobz commented Apr 16, 2023

Released as metrics@v0.21.0.

Thanks again for your contribution!

@tobz tobz removed the S-awaiting-release Status: awaiting a release to be considered fixed/implemented. label Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-core Component: core functionality such as traits, etc. C-util Component: utility classes and helpers. E-simple Effort: simple. T-refactor Type: refactor.
Projects
None yet
2 participants