ePrivacy and GPDR Cookie Consent by Cookie Consent

Starting, stopping and interrupting

Synchronous state machine

To start the synchronous state machine (state_machine) use the method “run”. This method starts the state machine and checks for initial transitions that need to be executed (and executes them) . After that, the events fired by the user are processed.

To stop the synchronous state machine use method "halt".

It is an error if you do not stop a running state_machine before destroying it!

Asynchronous state machine

To start the asynchronous state machine (async_state_machine) use the method "run". This method starts the state machine and checks for initial transitions that need to be executed (and executes them). If no terminate pseudostate is reached, it proceeds with starting the event processing thread.

To stop the asynchronous state machine, the async_state_machine provides the "halt_and_join" method. This method stops the event processing thread.

All events in the queue are handled before the state machine stops. Adding new events to the queue while the state machine is trying to stop will prevent it from doing so!

Finally the "halt_and_join" method joins the event processing thread.

It is an error if you do not stop a running async_state_machine before destroying it!

The asynchronous state machine also provides the possibility to be separately stopped and joined by calling the "halt" and "join" methods independently.

The two step stopping procedure is useful if you have other threads that need to be stopped. Thus you can first trigger to stop all threads and then join them. This will reduce shut down time.

Interrupting

A state machine can be interrupted by calling the "interrupt" method. Calling this function will cause the event processing to be aborted even in the middle of a compound transition. Also the state machine will stopped.

For the asynchronous state machine, "join" needs to be called manually after the "interrupt" was called.