alex2005
alex2005

Reputation: 1

boost asynchronous_state_machine

Is it possible to get ref to scheduler from processor_handle for asynchronous_state_machine?

Code:

struct A {
    A(sc::fifo_scheduler<>::processor_handle& h):player_ref(h){}
    sc::fifo_scheduler<>::processor_handle& player_ref;
    void a_func(){
       //I have to send event to player, but don't have scheduler
       scheduler.queue_event( player_ref_, ... ); //?
    }
};

sc::fifo_scheduler<> scheduler( true );
sc::fifo_scheduler<>::processor_handle player = 
    scheduler1.create_processor< Player >();
A a(player); 

Upvotes: 0

Views: 508

Answers (1)

user49572
user49572

Reputation:

No, not currently. By design, the existence of a processor_handle object does not guarantee the existence of the scheduler the processor is hosted in.

So, in your scenario you have to pass the scheduler to the constructor of A and store it in a data member.

Upvotes: 1

Related Questions