-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
bevy_reflect: Adding support for Atomic values #14419
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Looks like the build is failing due to an unrelated warning in bevy_render. |
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 think SeqCst
is the right choice here, but I'm not familiar enough with atomics to fully make that decision. If someone else has feedback there, please feel free to leave a comment!
Otherwise just a couple suggestions!
- Moving impl_type_path! to the top of the macro and adding impl_function_traits! - Removing fully qualified type paths in the macro (but adding them for the Ordering type for consistency)
Relaxed ordering should be fine. Those methods don't seem like points for synchronization, especially because they would need to synchronize with a store somewhere. |
I think I've addressed all of the feedback. Regarding Relaxed vs. SeqCst, SeqCst is the strictest option and is the default in other languages when you don't specify one. The only downside is pretty minor perf hits, and even then primarily on ARM rather than x86 (which has strong memory guarantees to begin with). Since this is in reflection code to begin with and because the user won't be able to control the ordering mode, I don't think the perf hit is as bad as potentially unexpected behavior. |
Is this still S-Needs-Review? I'm new to bevy PRs so not sure how all the labels work. |
Yeah you need 2 community approvals before getting moved to |
Fixes #14418
Note that this does not add AtomicPtr, which would need its own special casing support, just the regular value types.
Also, I was forced to be opinionated about which Ordering to use, so I chose SeqCst as the strictest by default.