Boost logo

Boost :

Subject: Re: [boost] Boost MSM parallel behavior with delayed self-transitions?
From: Danylo Malyuta (danylo.malyuta_at_[hidden])
Date: 2017-03-21 20:35:02


Hi Christophe,

Thanks for your input. I'm going to use std::thread for the parallel
functionality, I think. How stable/complete is Asynchronous? Can I rely on
it, or would I still have a moderate chance of running into bugs?

Best,

Danylo.

PS. I love your documentation! What do you use for state machine diagrams -
MagicDraw?

On Tue, Mar 21, 2017 at 1:11 PM, Christophe Henry via Boost <
boost_at_[hidden]> wrote:

> Hi Danylo,
>
> >Hi community,
> >
> > I am using Boost MSM (basic and functor front-ends) and am trying to
> >implement the following state machine (https://i.stack.imgur.com/
> K79qk.png
> ):
>
> Ok, State1 is itself a state machine (also called composite). See:
> http://www.boost.org/doc/libs/1_63_0/libs/msm/doc/HTML/ch02s02.html#d0e151
> and:
> http://www.boost.org/doc/libs/1_63_0/libs/msm/doc/HTML/ch03s02.html#d0e529
>
> Then you have 2 active states, which are called orthogonal regions. See:
> http://www.boost.org/doc/libs/1_63_0/libs/msm/doc/HTML/ch03s02.html#d0e577
>
> >I am using Boost MSM (basic and functor front-ends) and am trying to
> >implement the following state machine: enter image description here
> >
> >In words:
> < snip >
> >
> >I would like to know the way to create this state machine in Boost MSM.
>
> The above link has an example.
>
> >There are two tricks here which I cannot figure out how to do:
> >
> > - Execution in parallel (i.e. running action_A does not stop running
> >action_B at the same time)
>
> It depends what you mean with "in parallel". Having 2 active states means
> that the actions execute only logically at the same time, meaning within
> the same process_event call. But as you have just one thread, they will
> execute after each other.
> If you mean in different threads, then no, the library does not support
> this. But my next library, Asynchronous does (
> https://github.com/henry-ch/asynchronous).
> I have examples with state machines, timer, etc.
>
> >- Delayed transition (i.e. the transitions which happen after 2
> >seconds for state A and after 5 seconds for state B). Neither delay
> >should be blocking! The transitions should just "fire" after this time.
>
> Sorry, this is out of scope of the library as it would involve threads. You
> can do one of the following:
> - use your own timer (Boost.Asio offers one) and handle thread safety
> yourself.
> - have a look at Asynchronous. Sorry if it looks like advertising, but the
> library was written for this kind of things.
>
> >Thank you very much for helping,
> >
> >Danylo.
>
> HTH,
> Christophe
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/
> mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk