-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Replace some !Send
resources with thread_local!
#17730
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 0319455.
b0e821c
to
38ffe2c
Compare
1a9c211
to
789a9bf
Compare
789a9bf
to
df85779
Compare
Won't this cause multiple worlds to share the same |
Yes, in theory multiple worlds could share these resources. However, in practice in this PR, that is not happening. Keep in mind, I am not changing the API in any way. I am only changing how a few internal variables are stored. |
@alice-i-cecile, just pinging you here for review on GitHub as well, in case that's your preferred workflow |
!Send
resources with thread_local!
!Send
resources with thread_local!
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!
751410f
to
a114044
Compare
a114044
to
c62693c
Compare
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.
Objective
Work for issue #17682
What's in this PR:
!Send
resources that Bevy uses internally!Send
resources withthread_local!
staticWhat this PR does not cover:
!Send
resources still exists!Send
resources are present (and should not be removed until the ability to create!Send
resources is removed)log_layers_ecs
still uses a!Send
resource. In this example, removing the!Send
resource results in the system that uses it running on a thread other than the main thread, which doesn't work with lazily initializedthread_local!
static data. Removing this!Send
resource will need to be deferred until the System API is extended to support configuring which thread the System runs on. Once an issue for this work is created, it will be mentioned in 🐢 Eliminate!Send
resources by supportingSend
and!Send
World
in the same binary #17667Once the System API is extended to allow control of which thread the System runs on, the rest of the
!Send
resources can be removed in a different PR.