0

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); 
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
alex2005
  • 1
  • 1

1 Answers1

1

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.