Boost logo

Boost Users :

Subject: [Boost-users] [msm] Stuck in pseudo exit
From: Chrisopher Vogl (christopher.vogl_at_[hidden])
Date: 2015-02-26 03:18:41


Hi all,

I have got a sub state machine (called Calibrate) which is exited via a
pseudo exit on an event called Ev_Exit. The event is triggered on the
return of a synchronous D-Bus call. So far everything works fine.

Now I wanted to use an async D-Bus call and trigger the event in the
finished-handler of the asynchronous D-Bus call. I can see that the
event is released and that the transition into the pseudo exit takes
place but the control is not given back to the outer state machine, i.e.
the following transition in the outer state machine is not executed:

Row < Calibrate::exit_pt<PseudoExit> , Ev_Exit , CheckNFC , none
, none >,

Instead I get the log output that there is no transition for event
Ev_Exit in the sub machine:

user.notice tm-calibration: void
hale::tmop::Calibration_::Calibrate_::CheckKconst::on_exit(const Event&,
FSM&) [with Event = hale::tmop::Ev_Exit; FSM =
boost::msm::back::state_machine<hale::tmop::Calibration_::Calibrate_>]
user.notice tm-calibration: void hale::tmop::PseudoExit::on_entry(const
Event&, FSM&) [with Event = hale::tmop::Ev_Exit; FSM =
boost::msm::back::state_machine<hale::tmop::Calibration_::Calibrate_>]
user.notice tm-calibration: void
hale::tmop::Calibration_::Calibrate_::no_transition(const Event&, FSM&,
int) [with FSM =
boost::msm::back::state_machine<hale::tmop::Calibration_::Calibrate_>;
Event = hale::tmop::Ev_Exit], No transition from state

I get the same behaviour when I try to use Glib's signal_timeout() to
generate timeout events in a sub machine. Then the sub machine gets also
stuck in the pseudo exit.

I'm using boost 1.53. The program is not multi-threaded and I'm using
Glib's main loop.

Part of transition table in sub machine called Calibrate:
...
Row < CheckKconst , Ev_Exit , PseudoExit , none
, is_exit_ok >,
Row < CheckKconst , Ev_Exit , ShowDesc , showImpError ,
is_exit_error >,
...
with

enum ExitReason
{
     EXIT_REASON_NONE,
     EXIT_REASON_OK,
     EXIT_REASON_TIMEOUT,
     EXIT_REASON_ERROR
};

struct Ev_Exit
{
     ExitReason exitReason_;
     std::string message_;
     int code_;

     Ev_Exit()
         : exitReason_( EXIT_REASON_NONE ), code_( 0 )
     {}

     Ev_Exit( ExitReason exitReason, std::string message = "", int code
= 0 )
         : exitReason_( exitReason ), message_( message ), code_( code )
     {}

     template <class Event>
     Ev_Exit( Event const& )
         : exitReason_( EXIT_REASON_NONE ), code_( 0 )
     {}
};

struct is_exit_ok
{
     template <class EVT, class FSM, class SourceState, class TargetState>
     bool operator()( EVT const& evt, FSM& fsm, SourceState& ss,
TargetState& ts )
     {
         return evt.exitReason_ == EXIT_REASON_OK;
     }
};

struct PseudoExit : public msm::front::exit_pseudo_state<Ev_Exit>
{
     template <class Event,class FSM>
     void on_entry( Event const& evt, FSM& fsm ) {}

     template <class Event,class FSM>
     void on_exit( Event const& evt, FSM& fsm ) {}
};


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net