Page 1 of 1

Running Several StateMachine in one program.

Posted: 29 Aug 2018, 18:45
by Milad
Hi,
First I have to appreciate your outstanding work. It is amazing.
I have a question is it possible to run several independent state machine in just one program? The state machines are run in different threads. Now I have run on state machine in one sub-thread and there is one in my main thread as well.
The problem is that when I run the main state machine the second one seems not working anymore.
Both of them are sync state machine.
Thank you in advance for your answer and time.

Re: Running Several StateMachine in one program.

Posted: 04 Sep 2018, 10:07
by Wolfgang Petroschka
Hi Milad,

firstly sorry for the delayed answer. I had overlooked the notification email.

"First I have to appreciate your outstanding work. It is amazing."
Thank you very much!

Yes, it is possible to run multiple state machines in one program. And it is a very common use case.
sync state machines just need to get their events in the corresponding threads. Are you firing the events in the corresponding threads (one time in the main thread, one time in the sub-thread)?
However, I recommend the use of async state machines whenever possible because they "automatically" run in their own threads without any further work on the side of the developer. I would only use sync state machines if absolutely necessary (e.g. on a system with low resources).

If you have further problems or if you want us to have a look at your current problem, please provide us with some minimal source code reproducing the problem. Then we'll have a look.

Best regards,
Wolfgang

Re: Running Several StateMachine in one program.

Posted: 23 Oct 2018, 08:03
by Milad
Hi,
Thank you very much for your answer.