-
Notifications
You must be signed in to change notification settings - Fork 773
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
core: add portable-atomic
support
#3199
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenjaminBrienen
approved these changes
Jan 23, 2025
BD103
approved these changes
Jan 24, 2025
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.
Changes look good to me!
9d3856b
to
498e1b3
Compare
hds
approved these changes
Mar 31, 2025
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.
Thanks for this change! Looks good!
fix formatting.
portable-atomic
support to tracing-core
portable-atomic
support
hds
pushed a commit
that referenced
this pull request
Apr 10, 2025
This PR expands [`portable-atomic`](https://docs.rs/portable-atomic/) utilisation within Tracing, improving platform support without breaking the existing public API. ## Motivation Since #3199 was merged, it's now possible to bring more tracing crates to atomically challenged platforms through `portable-atomic`. Additionally, CI is not currently setup to ensure this feature behaves as expected (allowing compilation on platforms with incomplete atomic support). ## Solution - Added `portable-atomic` support to: - `tracing` - `tracing-futures` - `tracing-serde` - `tracing-subscriber` - Added `no_std` support to: - `tracing-macros` - `tracing-futures` - Added CI task to catch regressions in `portable-atomic` _and_ `no_std` support. ## Notes - A `critical-section` feature is also added to make CI testing and usage of `tracing`/etc. on atomically challenged platforms simpler. - No additional dependencies are included in this PR, optional or otherwise. Instances of including `portable-atomic` as a dependency only occur when it would have already been included transitively via `tracing-core`'s `portable-atomic-util` dependency. - I checked all instances of replacing `core::sync::atomic` with `portable-atomic` to ensure the public API was unaffected. As such, this is not a breaking change, since it simply adds `portable-atomic` and `critical-section` features.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Solution
portable-atomic-util
as an optional dependency gated behind a new feature,portable-atomic
totracing-core
portable-atomic
is enabled, switched uses ofArc
andWeak
away fromalloc::sync
toportable_atomic_util
.Notes
I'm currently working on
no_std
support for the Bevy Game Engine, which includes targeting embedded devices without full native support for atomics, such as the RP2040 Raspberry Pi Pico. Usingportable-atomic
, users can provide a fallback implementation for atomics to libraries (typically throughcritical-section
), allowing libraries to depend on atomics even on unsupported platforms. This PR would allow usingtracing
on more platforms without sacrificing ergonomics or performance on existing ones.This is my first time contributing to
tracing
, so please reach out if there's anything I can do to help with reviewing and merging this change!