Boost C++ Libraries: Ticket #3963: state_machine<>::post_event is not protected https://svn.boost.org/trac10/ticket/3963 <p> According to documentation, the member function state_machine&lt;&gt;::post_event() is protected to ensure that it's only called from within state reactions. However, in the actual code this function is declared public, which allows to call it from outside the state machine with unknown consequences. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3963 Trac 1.4.3 Arne Babnik <boost@…> Fri, 26 Feb 2010 09:04:08 GMT cc set https://svn.boost.org/trac10/ticket/3963#comment:1 https://svn.boost.org/trac10/ticket/3963#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">boost@…</span> added </li> </ul> Ticket Andreas Huber Sun, 04 Apr 2010 09:06:51 GMT status changed https://svn.boost.org/trac10/ticket/3963#comment:2 https://svn.boost.org/trac10/ticket/3963#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Andreas Huber Sun, 04 Apr 2010 10:18:30 GMT <link>https://svn.boost.org/trac10/ticket/3963#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3963#comment:3</guid> <description> <p> post_event will be made protected. Unfortunately, it *must* forward to a public implementation function, because that is also called from simple_state&lt;&gt;::post_event and template friend support is spotty in some popular compilers. However, I'll add an assert that catches calls to the implementation function, that are made when no event is currently being processed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andreas Huber</dc:creator> <pubDate>Sun, 04 Apr 2010 18:45:46 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3963#comment:4 https://svn.boost.org/trac10/ticket/3963#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/61048" title="Fixes #3963. post_event() is now protected and forwards to ...">[61048]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3963" title="#3963: Bugs: state_machine&lt;&gt;::post_event is not protected (closed: fixed)">#3963</a>. post_event() is now protected and forwards to post_event_impl(), which unfortunately must remain public. So, client code can still abuse the class by calling post_event_impl(), but the abuse should now be more obvious. I considered adding an assert to post_event_impl(), so that unauthorized calls from the outside could at least be detected at runtime, but it turned out that an assert requires more additional machinery than expected, which is why it was not implemented. </p> <p> Thanks for the report! </p> Ticket xuefer@… Wed, 04 Aug 2010 12:32:09 GMT <link>https://svn.boost.org/trac10/ticket/3963#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3963#comment:5</guid> <description> <p> what should i do if i want to connect multiple state machines making them interactive with each other? i used to use process_event(), and sometimes post_event() to make it happen after current state processing. i have code that guarantee all posted event will be flushed/processed later </p> </description> <category>Ticket</category> </item> <item> <author>boost@…</author> <pubDate>Wed, 04 Aug 2010 13:26:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3963#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3963#comment:6</guid> <description> <p> Multiple state machines can interact with each other quite nicely if they derive from asynchronous_state_machine instead of state_machine. Despite the name they may also run in the same thread context or without any separate thread at all. This also avoids the need to deal with possible recursions. I used to use synchronous state machines at first, but switched over to asynchronous state machines due to this. The only disadvantage to me is that it is more difficult to access the state machine from the outside, e.g. to retrieve the current machine state for debugging purposes. </p> <p> Read the part on asynchronous state machines in the tutorial for further information: <a href="http://www.boost.org/doc/libs/1_43_0/libs/statechart/doc/tutorial.html#AsynchronousStateMachines">http://www.boost.org/doc/libs/1_43_0/libs/statechart/doc/tutorial.html#AsynchronousStateMachines</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>