Boost logo

Boost Users :

Subject: [Boost-users] [StateChart] event processing order in async machine
From: Igor R (boost.lists_at_[hidden])
Date: 2010-10-17 18:56:07


Hello,

I've got an async. state machine (1.44, MSVC10), and sometimes I
observe a very strange behavior: events being processed not in the
order they are queued. I spent some time trying to investigate this
issue, but due to the asynchronous nature of the processing, it's
quite not trivial. So, before I start sinking too deep, I'd like to
ensure I don't miss something trivial.

Unfortunately, I don't have at the moment any self-contained code, but
a very simplified model of my FSM is as follows. Assume there are 2
events: Ev1, Ev2. The both are queued to the FMS from the same thread,
always in the same order: Ev1, Ev2. The FSM processes them in another
thread.
The FMS has some "entry" chain of states that defer the both events:

S1 /[defer(Ev1, Ev2)] --> S2 /[defer(Ev1, Ev2)]

and finally 2 orthogonal sub-states, one of them ignores the both
events, and the other processes the both:

...S2 --> S3<S3_1, S3_2>,
S3_1 /[custom_reaction(Ev1), in_state_reaction(Ev2)]

What I see is that *sometimes* the reaction for Ev2 is invoked
*before* the reaction for Ev1.
This "sometimes" really puzzles me: I'm absolutely sure that the order
of queuing is always the same - so where can be a "race"?

Any idea would be appreciated!


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