Skip to content

Signals and thread safety #858

Answered by skypjack
Net5F asked this question in Q&A
Mar 26, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Out of the box, signal support for storage classes isn't thread safe. It fits the way one should use an ECS, that is, by elaborating different component types in parallel.
However, signal support is just a mixin. If you do want to make it fully thread safe, you can by switching it off and replacing it with your own implementation.
That being said, I would probably spawn signals as components in my simulation, then have a system at the end of the loop that forwards all these items to their listeners. This way, you don't have to reinvent the wheel or add yet another layer on top of something that works already for what you're looking for.
Dunno if it's clear, let me know in case it is not a…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Net5F
Comment options

@skypjack
Comment options

@Net5F
Comment options

Answer selected by Net5F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion it sounds interesting, let's discuss it
2 participants