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

Allow NonSend components #2486

Closed
alice-i-cecile opened this issue Jul 15, 2021 · 2 comments
Closed

Allow NonSend components #2486

alice-i-cecile opened this issue Jul 15, 2021 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Jul 15, 2021

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

Allow data that is not Send to be stored in components, increasing API flexibility.

This is particularly useful for structs that contain a Cell or similar, allowing for interior (within-system) parallelization.

What solution would you like?

Mirror / share the NonSend resource API. Systems that have at least one NonSend component or resource access can only run on the main thread to ensure that the data does not have to be passed between threads.

Reusing NonSend for both resources and components would be the best naming scheme for this if possible.

What alternative(s) have you considered?

Store a reference to a NonSend resource maybe? Just Don't Do That.

Additional context

This will impact the Component trait (#1843), as it will not include Send + Sync trait bounds. Instead, those will be limited to using components in a parallelizable fashion.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled A-ECS Entities, components, systems, and events and removed S-Needs-Triage This issue needs to be labelled labels Jul 15, 2021
@Ratysz
Copy link
Contributor

Ratysz commented Jul 16, 2021

Systems executor relies on this method (looks like it's better-documented on the main branch?) to know if it has to schedule the system on the main thread. It simply reads SystemMeta::is_send, which is set in SystemParamState::init(). Should be plug-and-play.

@james7132
Copy link
Member

james7132 commented Dec 4, 2022

Closing this for the same reasons as #1719 and #4247. Supporting !Send resources and components has serious soundness issues with World: Send + Sync and has scheduling issues.

For more context, please see this discussion on Discord: https://discord.com/channels/691052431525675048/692572690833473578/1047997793375096852, and #6552.

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-Feature A new feature, making something new possible
Projects
None yet
Development

No branches or pull requests

3 participants