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

Added the option of firing triggers in a threadsafe manner on the state machine, enabling usage of SM as a shared resource between threads #600

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

IvaTutis
Copy link

No description provided.

@IvaTutis IvaTutis changed the title Mutex Added the option of firing triggers in a threadsafe manner on the state machine, enabling usage of SM as a shared resource between threads Sep 13, 2024
@IvaTutis
Copy link
Author

This works brilliantly when using SM as eg. a singleton in a multithreaded app. I'm eager to hear your feedback.

@leeoades
Copy link
Contributor

leeoades commented Dec 2, 2024

Hi @IvaTutis,
I can't see any unit tests. It would be well worth creating some that bombard the state machine with multiple threads in order to prove integrity.

@leeoades
Copy link
Contributor

leeoades commented Dec 2, 2024

That said, I would not personally recommend this approach. Instead, I would wrap the state machine within a component that handles the thread-safety. There is no need to introduce such complexity into the state machine itself.

@crozone
Copy link
Collaborator

crozone commented Dec 3, 2024

Please see discussion #527

We have not settled on a strategy, but we are more likely to eventually use a dedicated firing mode (FiringMode.Serial) that internally serializes triggers, rather than using dedicated method overloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants