Boost logo

Boost Users :

Subject: Re: [Boost-users] Statechart problem
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2009-03-25 12:34:01

> I guessed that was the problem indeed I followed the event go pushed into
> the event queue but it miraculously disappears somewhere very strange.

It doesn't disappear. It's simply held in the internal queue until you call
process_event() the next time. However, as I said before it's not a good
idea to use post_event this way.

> If I would make an event which encapsulates the message I would still
> need to send it from another thread and then I could only use the
> statemachine.process_event( EvEvent() ) mechanism. I tried that and the
> behavior was not exactly what I needed. The calling function would not
> leave the process_event method and hold op the system.

state_machine is not thread-safe and, more importantly, not reentrant, as
documented here:

So both of the approaches you tried are dangerous, to say the least.

> Maybe I should start thinking about rewriting the code to use the
> asynchronous_state_machine.

Yes, that sounds like a good idea. The usage of asynchronous_state_machine
is very different from the one of state_machine, so don't hesitate to post
here if you run into any problems.


Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

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