Subject: Re: [boost] [MSM] Interrupt anonymous transitions or blocking process_events?
From: anlmat (anlmat_at_[hidden])
Date: 2011-04-22 16:17:01
>> Anyway, you can see an outline below of how I did this. Perhaps this is
>> an ok way doing it?
> Depending on how you use it, yes. I'm a bit worried with race
> conditions in case your state machine is also used in another thread,
> which would also call process_event.
Yes, I protect every call to process_event with a mutex. Since I don't
have that many events I have created a member function that wraps and
protects the process_event call. (One member function per event.)
> Alternatively (if you want to avoid locking/deadlocking/rc), you could
> also move the worker thread out of the fsm and have both communicate
> with synchronized message queues. You might want to have a look at
> boost::circular_buffer, which provides an example
Yes, that is an interesting idea. But how do you solve the problem with
passing events on to the message queue? The events are all of different
types. Do you mean that there should be some parsing of strings or some
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk