Boost logo

Boost Users :

Subject: Re: [Boost-users] [MSM] What happens to MSM if guard returns `false`, mutable events and error recovery?
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2017-06-05 15:36:02

> what happens to MSM if guard returns `false`

If the guard returns false, then the state transition and transition action
do not happen. This is not an error, it's expected behaviour.

> Regarding the const events

If you want event data to be mutable, pass a reference to mutable data in
the immutable event object. If the lifetime of the mutable data is
nondeterministic, hold a shared_ptr to shared mutable state in the event

On 28 May 2017 at 08:42, Ovanes Markarian via Boost-users <
boost-users_at_[hidden]> wrote:

> Hi *,
> I am currently reading through the MSM docs and have one question, what
> happens to MSM if guard returns `false`. Does the MSM enter an error state
> in orthogonal region (
> /1_64_0/libs/msm/doc/HTML/ch03s02.html#d0e577)? Even internals page
> describes, what happens if guard returns `true`, but not a single word on
> `false` case.
> Regarding the const events: I am programming an MSM to proxy network
> traffic and once a message with data was received it'll be analysed and
> moved between different states. Message instances implement move semantics.
> Currently, the MSM has an initial state `ready` where the `message_in`
> event is handled. This event contains the message to be analysed. From my
> current understanding I either have to make message field in `message_in`
> event mutable or MSM needs to to support r-value references. Can somebody
> tell me what's going to happen if the action only accepts r-value reference
> to an event instance? Currently, it seems to work, but would like to
> understand the implications.
> struct some_action_impl {
> template<class Fsm, class Event, class SourceState, class TargetState> void operator()(Event&& ev, Fsm& fsm, SourceState& source, TargetState& target) { ... }
> }
> My last question relates to multi-threading. I understand that MSM manages internal states, would it be safe to create MSM as a thread-local storage and restart the thread-local MSM if the new request comes in? It's more about, what happens to MSM after an error state? Is calling stop(), start() members enough?
> Many thanks for help,
> Ovanes
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

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