[statechart] (custom) state queries for asynchronous state machine
Hi, I'm trying to figure out how to perform (custom) state queries on statechart's asynchronous state machines. The tutorial at http://www.boost.org/doc/libs/1_44_0/libs/statechart/doc/tutorial.html#State... how to do this for synchronous state machines - using state_iterator and the state machine's state_begin() and state_end() member functions. However, for the asynchronous case, access to the state machine is via a scheduler only - and I don't see how to get the information from there nor is there any documentation on that in the tutorial. Any hints on how to do this? Regards, Loek
However, for the asynchronous case, access to the state machine is via a scheduler only - and I don't see how to get the information from there nor is there any documentation on that in the tutorial. Any hints on how to do this?
With async. state machine such a direct access wouldn't be thread safe. So the only way you can retrieve its state is by means of events. I.e. you can enqueue an event, which contains some facility for the response - like a ptr to a message queue or a slot for boost.signals2 and so on. When processing this event, the machine performs the query you want and returns you the answer through the facility you provided.
participants (2)
-
Igor R
-
Loek Cleophas