I'm trying to use in_state_reaction
.
Oddly the react function for this doesn't seem to be executed after process_event ()
is called.
I changed in_state_reaction
to custom_reaction
and it seems fine.
Just want to know how do I make it work with in_state_reaction
.
I must be doing something wrong.
I'd appriciate sample codes. Not a lot samples out there for in-state.
Thanks.
struct Reset : sc::simple_state<Reset, Idle>
{
Reset() { }
~Reset() { }
typedef sc::in_state_reaction<Event1> reactions;
sc::result react(const Event1 &)
{
printf ("In state reaction\n");
return discard_event();
} // react
}; // Reset
in_state_reaction
is not a custom reaction, so react
wouldn't be called!
In-state reaction means that you want to invoke some function and to keep staying in the same state.
in_state_reaction<Event1, Context, &Context::doSomething>
Use custom reaction when you can't know in compile-time what your destination state is.