Boost MSM -

newbi question pleasee bare with me as Im struggling with this.

I want to use boost msm state machine but i am having a hard time imagining how it works. Let say we only have 2 states (s1, s2) and to go from s1 to s2 you need event e1 to be fired and to bo back you need another one e2. e1 and e2 can only be fired from within s1 and s2 respectively.

Now in main() I start by starting the statemachine (start()) then ill have a while loop that every 1 min will go back to the state machine but have to pick up from where it left.i.e.

1
2
3
4
5
6
7
8
9
10
11
12
main()
{
 MSM.start(); //start state machine

 while (a_condition)
 {
 ProcessInputsfromIO();
 Go_backtoStatemachine(); //how can i do this?
 delay(1min)
 }
 MSM.stop();
}

So basically when a state finishes executing, the statemachine will exit, then ill have a delay of 1 minutes, then the while loop will need to take me back to the state I was before I exit, or I think that's how we should implement a state machine.

Is what I am asking for out of the ordinary? If yes then how do people implement a non-blocking state machine? if no, then how can I implement Go_backtoStatemachine()?
Topic archived. No new replies allowed.