Hi,
is it allowed to call fifo_scheduler<>::operator() from state constructor?
If yes, then let's assume "scheduler" and "processor" are objects of
"fifo_scheduler<>" and "fifo_scheduler<>::processor_handle" types
respectively in the some state constructor code below:
State(my_context ctx): my_base(ctx)
{
boost::intrusive_ptr<Event> pEvent(new Event());
// If both lines [A] and [B] are uncommented
// then "unconsumed_event" method is called twice.
// If just line [A] is uncommented then "unconsumed_event" method is called.
// If just line [B] is uncommented then certain "react" method is called.
// scheduler.queue_event(processor, pEvent); // [A]
// this->post_event(Event()); // [B]
scheduler();
}
Note constructor calls "scheduler()" at the end.
Other questions:
Is this code correct and runs expectedly as described in comments?
Why "unconsumed_event" is called if use "queue_event" instead of "post_event"?
Thanks,
Andrew.