sml icon indicating copy to clipboard operation
sml copied to clipboard

Gco/non trivial event missed processing

Open GuiCodron opened this issue 5 years ago • 1 comments

Problem:

  • Non trivial on_exit/on_entry can hide on_entry<>/on_exit<> in parents state machine. This is due to a dual pass done to process non trivial event:
  • First we process non trivial event, then we process generic event if it failed. PR https://github.com/boost-ext/sml/pull/370 amplify this bug: on_exit are now processed like on_entry and return true if any child state handle the non trivial event, this imply that generic event will not be processed for parent states.

Solution:

  • Fix the problem by doing a single pass of processing that will trigger the correct event (either mapped or generic). This is done by updating mapping generation to take into account that on_entry/on_exit/unexpected_event have a specific generic event case.

Reviewers: @krzysztof-jusiak

GuiCodron avatar Aug 03 '20 08:08 GuiCodron

Apologies in advance to bring this old issue to life, but I am seeing the very same behavior and I wonder whether it is planned to apply a fix or not.

I can provide some examples that highlight the issue:

This example works as expected: https://gcc.godbolt.org/z/vxxceGzW3

However, if I replace state<Child> + sml::on_entry<_> by state<Child> + sml::on_entry<e2> on parent state machine, child on_entry<_> event is not processed. example

Similarly, replacing "s2"_s + sml::on_exit<_> by "s2"_s + sml::on_exit<e3> on child state machine, parent on_exit<_> is not processed. example

For completeness, if both child and parent state machines use the specific on_entry/on_exit version, everything works as expected

As a side note, if I am not wrong, child on_exit hides on_exit on parent state machine, while parent on_entry hides on_entry on child state machine, so the hiding may happen on both "directions"

guiserle avatar May 17 '23 13:05 guiserle