0

是否可以从 processor_handle 为 asynchronous_state_machine 获取调度程序的引用?

代码:

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); 
4

1 回答 1

1

不,目前没有。根据设计,processor_handle 对象的存在并不能保证处理器所在的调度程序的存在。

因此,在您的场景中,您必须将调度程序传递给 A 的构造函数并将其存储在数据成员中。

于 2011-03-02T15:51:05.513 回答