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

Lift Send requirement in wasm builds #9157

Closed
extrawurst opened this issue Jul 14, 2023 · 3 comments
Closed

Lift Send requirement in wasm builds #9157

extrawurst opened this issue Jul 14, 2023 · 3 comments
Labels
A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use O-Web Specific to web (WASM) builds X-Controversial There is active debate or serious implications around merging this PR

Comments

@extrawurst
Copy link
Contributor

What problem does this solve or what need does it fill?

Right now there is a requirement for a lot of things to be Send even in single-threaded targets like wasm: e.g Plugin and Resource. Would be great to lift that in wasm targets.

What solution would you like?

Do not require things to be Send

What alternative(s) have you considered?

Additional context

This blocks being able to use bevy_tokio_tasks for more stuff on wasm: see EkardNT/bevy-tokio-tasks#18 (comment)

@extrawurst extrawurst added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Jul 14, 2023
@konsti219
Copy link
Contributor

Wasm is not single-threaded. You can create multi-threaded wasm applications that run in browsers today.

Afaik bevy does not currently make use of this but keeping it as a future option without a breaking change is the way I personally would go.

@Selene-Amanita Selene-Amanita added A-ECS Entities, components, systems, and events O-Web Specific to web (WASM) builds C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR and removed C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels Jul 15, 2023
@james7132
Copy link
Member

Please see #4078 for more information. We eventually want to support full use of Web Workers in all WASM targets, but there are fundamental limitations that we may need to find a workaround for. Knowing this, conditionally lifting Send constraints, where relevant, seems shortsighted.

@james7132
Copy link
Member

With the work in #12205, it's pretty apparent that any !Send component or resource on wasm can be wrapped in send_wrapper or bevy_utils::SyncCell to achieve Send + Sync required for Resources or Components. If the actual environment is truly single threaded, both should be a non-issue to deal with. Closing this out for now.

@james7132 james7132 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use O-Web Specific to web (WASM) builds X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

No branches or pull requests

4 participants