Andreas:

Thank you for your prompt responses.  Also, since I neglected to do so in my initial post, thank you for the statechart library itself.  I spent a considerable amount of time implementing (and, alas, debugging) a statechart library of my own in C# a few years ago.  When another statechart-based project came along, and it was using C++, I was relieved to learn that your library existed.

Returning to the subject at hand:  The member variable that I want to share is a single boolean flag.  It would only be written by "self", and only read by self's twin.  There would not be any member variables that required shared read/write access.  I would use the provisions of the Boost thread library to ensure that these accesses were thread-safe, as Igor suggested.

But these are moot points if the framework makes such access impossible by design.  Given the limited amount of data involved, it will be easy to implement the required communication using an event as you advised.

Thanks again,

Tim Crews

GECO, Inc.


>> You can't, see above. Two asynchronous state machine must only exchange

>> data in

>> a, well, asynchronous manner. That is, have the requesting state machine

>> post

>> an event to the other FSM, which in turn posts the requested data in an

>> event

>> back to the requesting FSM. Of course you'll have to be careful to always

>> *copy* the data and never let both state machines access the same data

>> through

>> e.g. pointers.

>

<snip>

It depends on how long the lock is taken by each FSM. If we're just talking

lock, read/write, unlock then no I don't think you'd have any problems with

just two FSMs. The longer the lock is taken the more could shared data

access become a bottleneck and adversely affect performance.

Of course, for Tims problem (access of state-local data), this is not a good

solution as it would inevitably make the data non-local.

Regards,

--

Andreas Huber

When replying by private email, please remove the words spam and trap

from the address shown in the header.