-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
In the following example, a state machine containing 3 initial states is proposed. All these states should transit to the exit state when the event e1 is received. In order to propagate such event to all the initial states, it is deferred two times. The expectation is not satisfied since only the first defer works properly.
Example:
#include <boost/sml.hpp>
#include <cassert>
#include <deque>
#include <queue>
#include <iostream>
namespace sml = boost::sml;
namespace {
struct e1 {};
struct defer_and_process {
auto operator()() const noexcept {
using namespace sml;
return make_transition_table(
*"s1"_s + event<e1> / defer = X
,*"s2"_s + event<e1> / defer = X
,*"s3"_s + event<e1> = X
);
}
};
} // namespace
int main() {
using namespace sml;
sm<defer_and_process, sml::defer_queue<std::deque>, sml::process_queue<std::queue>> sm;
assert(sm.is("s1"_s, "s2"_s, "s3"_s));
sm.process_event(e1{});
std::cout << sm.is(X,X,"s3"_s) << std::endl; // TRUE - Expected to be FALSE
std::cout << sm.is(X,X,X) << std::endl; // FALSE - Expected to be TRUE
}
Is this the correct behavior? How can I implement the expected behavior?
Maverobot
Metadata
Metadata
Assignees
Labels
No labels