One more question. So how do the guard conditions work? Does the state machine keep checking periodically if the guard condition is satisfied or not and make transition if the condition is met or it checks for the condition only when an event occurs?
Thanks!
No. This would be again my metaphors about eating your cycles. It would also require an extra thread and this would be the race condition stuff. The guards are evaluated when you process an event. When you call process_event(event()), the state machine does: - check the guard. If true: - call the exit action - call the transition action - call the entry action - else: check if another transition is possible. If yes, repeat, otherwise stop. Then it does nothing again. HTH, Christophe