提升异步状态机
是否可以从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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,目前还没有。根据设计,processor_handle 对象的存在并不能保证处理器所在的调度程序的存在。
因此,在您的场景中,您必须将调度程序传递给 A 的构造函数并将其存储在数据成员中。
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.