statemachine
statemachine copied to clipboard
PassiveStateMachine fails to execute events fired by different callers on their respective threads. Is this expected?
While one caller is executing an event if different fires event it is returned after adding it to queue. Meanwhile, the first caller tries to execute the newly added event in the queue before it returns.
This creates an issue with Stop behavior as while one caller is busy with executing events in the queue if other callers go on adding events to queue still the state machine will be running till all events have been executed.
This is different from the description given for PassiveStateMachine related to State Machine Events Execution.
If you call the same state machine instance from multiple threads, you must use the ActiveStateMachine
. The PassiveStateMachine
cannot handle multiple threads.
The ActiveStateMachine
executes the events on its own thread and returns the call to Fire
after the event was queued.