Boost logo

Boost Users :

Subject: Re: [Boost-users] [MSM] state transitions and exceptions
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-04-06 15:45:23

>When there is an error in the outermost statemachine we propagate the
>exception out from it. At this point, the client code (which calls
>the process_event function) shall restart the state machine therefore
>resetting it to the initial state. But we cannot simply restart the
>machine because after we have thrown the exception out from it, it
>becomes nonresponsive, i.e. it does not react to the fsm->stop() and
>fsm->start() sequence.
>So we came up with the following:
>void Client::reCreateBackEnd()
>if(backEnd){ // backEnd is a smart pointer
>// Constructing the BackEnd
>backEnd.reset(new ...);
>backEnd->set_states( ... );
>It is too drastic to recreate the back end, I think. Christophe, is
>there any more elegant solution to do this? Why is it that the state
>machine becomes not restartable if an exception is thrown out from it?

Which version are you using? Until 1.49, it was not possible to call start()
a second time. I think your machine probably stayed in the state it was
before the exception.
If I understood your problem, it should be gone with 1.49.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at