【问题标题】:boost asynchronous_state_machine提升异步状态机
【发布时间】:2011-03-01 12:52:19
【问题描述】:

是否可以从 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); 

【问题讨论】:

    标签: c++ boost boost-statechart


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2015-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多