Boost logo

Boost Users :

Subject: [Boost-users] [statechart] fifo_scheduler<>::operator() in state constructor
From: Andrew C (achinkoff_at_[hidden])
Date: 2015-02-04 09:40:46


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
    // If just line [B] is uncommented then certain "react" method is

    // scheduler.queue_event(processor, pEvent); // [A]
    // this->post_event(Event()); // [B]


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


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at