Demos from some statemachine frameworks (Qt, Boost.MSM, ...)
There are 2 states: statePing and statePong.
Maximum lifetime of statePing is 1000 ms - it will then automatically transition to statePong;
Maximum lifetime of statePong is 2000 ms - it will then automatically transition to statePing.
(We want zero drift in using the timers!)
Keyboard-Input can cause transitions before the max-lifetime-timeouts:
'x': xchange state
'i': leave current state and go to statePing (pIng)
'o': leave current state and go to statePong (pOng)
't': toggle timer (on/off)
'q' or eof (Ctrl-d): exit
-
Boost.MSM using ASIO for Timers
seemsm/msm_ping_pong