-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Create new NonSendMarker
#18301
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
Create new NonSendMarker
#18301
Conversation
058b5fc
to
39cfc41
Compare
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
66119b0
to
d0f60b6
Compare
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
1 similar comment
Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! If it's expected, please add the M-Deliberate-Rendering-Change label. If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it. |
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.
Looks good!
876b73f
to
592adc0
Compare
Co-authored-by: Chris Russell <[email protected]>
592adc0
to
62a3201
Compare
Co-authored-by: Chris Russell <[email protected]>
# Objective Remaining work for and closes #17682. First half of work for that issue was completed in [PR 17730](#17730). However, the rest of the work ended up getting blocked because we needed a way of forcing systems to run on the main thread without the use of `!Send` resources. That was unblocked by [PR 18301](#18301). This work should finish unblocking the resources-as-components effort. # Testing Ran several examples using my Linux machine, just to make sure things are working as expected and no surprises pop up. --------- Co-authored-by: Chris Russell <[email protected]> Co-authored-by: François Mockers <[email protected]>
# Objective In #18301, `NonSendMarker` was defined in such a way that it actually implements `Send`. This isn't strictly a soundness issue, as its goal is to be used as a `SystemParam`, and it _does_ appropriately mark system access as `!Send`. It just seems odd that `NonSendMarker: Send`. ## Solution - Made `NonSendMarker` wrap `PhantomData<*mut ()>`, which forces it to be `!Send`. ## Testing - CI --- ## Notes This does mean constructing a `NonSendMarker` _value_ will require using the `SystemParam` trait, but I think that's acceptable as the marker as a value should be rarely required if at all.
# Objective Remaining work for and closes bevyengine#17682. First half of work for that issue was completed in [PR 17730](bevyengine#17730). However, the rest of the work ended up getting blocked because we needed a way of forcing systems to run on the main thread without the use of `!Send` resources. That was unblocked by [PR 18301](bevyengine#18301). This work should finish unblocking the resources-as-components effort. # Testing Ran several examples using my Linux machine, just to make sure things are working as expected and no surprises pop up. --------- Co-authored-by: Chris Russell <[email protected]> Co-authored-by: François Mockers <[email protected]>
# Objective In bevyengine#18301, `NonSendMarker` was defined in such a way that it actually implements `Send`. This isn't strictly a soundness issue, as its goal is to be used as a `SystemParam`, and it _does_ appropriately mark system access as `!Send`. It just seems odd that `NonSendMarker: Send`. ## Solution - Made `NonSendMarker` wrap `PhantomData<*mut ()>`, which forces it to be `!Send`. ## Testing - CI --- ## Notes This does mean constructing a `NonSendMarker` _value_ will require using the `SystemParam` trait, but I think that's acceptable as the marker as a value should be rarely required if at all.
Objective
Create new
NonSendMarker
that does not depend onNonSend
.Required, in order to accomplish #17682. In that issue, we are trying to replace
!Send
resources withthread_local!
in order to unblock the resources-as-components effort. However, when we remove all the!Send
resources from a system, that allows the system to run on a thread other than the main thread, which is against the design of the system. So this marker gives us the control to require a system to run on the main thread without depending on!Send
resources.Solution
Create a new
NonSendMarker
to replace the existing one that does not depend onNonSend
.Testing
Other than running tests, I ran a few examples:
window_resizing
wireframe
volumetric_fog
(looks so cool)rotation
button
There is a Mac/iOS-specific change and I do not have a Mac or iOS device to test it. I am doubtful that it would cause any problems for 2 reasons:
But it wouldn't hurt if someone wanted to spin up an example that utilizes the
bevy_render
crate, which is where the Mac/iSO change was.Migration Guide
If
NonSendMarker
is being used frombevy_app::prelude::*
, replace it withbevy_ecs::system::NonSendMarker
or use it frombevy_ecs::prelude::*
. In addition to that,NonSendMarker
does not need to be wrapped like so:Instead, it can be used without any wrappers: