0

let's say I have created several separate FSM classes inheriting from statechart. Then, I instantiate those objects, and I would like them to be able to trigger events in each other; for example the first FSM would enter a "ON" state and would trigger an event in the second FSM (like process_event(EvSomething()) ).

What would be the best method to do that?

Thank you very much,

Fabrizio

fabrice79
  • 1
  • 1

1 Answers1

1

The main motivation for Asynchronous State Machines is exactly the scenario you describe. So, I would suggest you convert your machines into asynchronous ones. See here for an example.

  • Yeah, I realized that after Igor's comment. Dealing with it right now. Anyway, if FSMs are not working bi-directionally (they just trigger process_event in other FSMs, but don't expect anything back), are they going to work correctly in the synchronous way? – fabrice79 Sep 13 '12 at 08:43
  • 1
    @fabrice79: The issue is that process_event of a given state_machine subclass object is not reentrant. So, as long as you ensure that this constraint is not violated everything should work as expected. –  Sep 14 '12 at 15:55