Boost logo

Boost :

Subject: [boost] Boost MSM parallel behavior with delayed self-transitions?
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2017-03-21 20:11:50

Hi Danylo,

>Hi community,
> I am using Boost MSM (basic and functor front-ends) and am trying to
>implement the following state machine (

Ok, State1 is itself a state machine (also called composite). See:

Then you have 2 active states, which are called orthogonal regions. See:

>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 (
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
- 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,


Boost list run by bdawes at, gregod at, cpdaniel at, john at