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

Commands' Current Entity within Arc<Mutex<>> #795

Closed
entropylost opened this issue Nov 5, 2020 · 4 comments
Closed

Commands' Current Entity within Arc<Mutex<>> #795

entropylost opened this issue Nov 5, 2020 · 4 comments
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior

Comments

@entropylost
Copy link
Contributor

Commands can be cloned and passed between threads. This makes it so each thread has the same current_entity, which can cause interference; say if one does a .spawn and the other thread does a .with the other thread might pick up the current_entity from the first thread.

I suggest moving the current_entity to be outside of CommandsInternal to solve this problem.

@entropylost entropylost added the C-Bug An unexpected or incorrect behavior label Nov 5, 2020
@entropylost
Copy link
Contributor Author

(And make insert set current_entity while you're at it...)

@karroffel karroffel added the A-ECS Entities, components, systems, and events label Nov 5, 2020
@cart
Copy link
Member

cart commented Nov 9, 2020

In #798 we removed the arc/mutex from Commands by default, but this issue does still exist for the new Arc<Mutex<Commands>> system parameter. We might need to swap that out for something like ParallelCommands, which would maintain the current entity in each instance.

@MinerSebas
Copy link
Contributor

In 0,5 spawning a new Entity returns an EntityCommands that stores the Entity Id instead.
This means that this Issue can now be closed.

@entropylost
Copy link
Contributor Author

I have no idea why I wanted this or why it doesn't exist so I'll close it.

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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants