Boost logo

Boost Users :

Subject: [Boost-users] [MSM] What happens to MSM if guard returns `false`, mutable events and error recovery?
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2017-05-28 06:42:46


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 (http://www.boost.org/doc/
libs/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 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