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

Add portable-atomic support to tracing-core #3199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bushrat011899
Copy link

Motivation

Solution

  • Added portable-atomic-util as an optional dependency gated behind a new feature, portable-atomic to tracing-core
  • When portable-atomic is enabled, switched uses of Arc and Weak away from alloc::sync to portable_atomic_util.
  • Added workaround for a lack of support for unsized coercion in custom types. I've included a comment linking to this issue explaining the missing functionality.

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. Using portable-atomic, users can provide a fallback implementation for atomics to libraries (typically through critical-section), allowing libraries to depend on atomics even on unsupported platforms. This PR would allow using tracing 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!

Copy link

@BD103 BD103 left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

portable-atomic support for alloc::sync in tracing-core
3 participants