是否可以从asynchronous_state_machine的processor_handle获取调度程序的引用?
代码:
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); 发布于 2011-03-02 23:51:06
不,目前还没有。根据设计,processor_handle对象的存在并不保证托管处理器的调度器的存在。
因此,在您的场景中,您必须将调度程序传递给A的构造函数,并将其存储在数据成员中。
https://stackoverflow.com/questions/5154747
复制相似问题