Boost logo

Boost Users :

Subject: [Boost-users] [msm] multi thread access
From: Sam Fisher (infest21h_at_[hidden])
Date: 2015-01-23 06:00:12


Hi Christophe,

Did you consider adding build-in multi-thread support? (via policies maybe?)

For example, I can guaranteed that all access to sub-fsm within its
handlers (process_event()) will be synchronized.
The problem is, sub-fsm "knows" about its parent and internally
communicates with it (forwarding events etc). I can't control it from my
side.

typical scenario:
an action from sub-fsm

struct A_Init
{
   template <typename Evt, typename FSM, typename SourceState, typename
TargetState>
   void operator()(Evt&, FSM& fsm, SourceState&, TargetState&) const
   {
     std::thread([=]() mutable
     {
       std::lock_guard<std::mutex> l(access);
       fsm.process_event(some_event());
     }).detach();
   }
};

locking proccess_event() in sub-fsm doesn't help if it alters the root.


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