bowei_wang 发表于 2008-4-16 16:13:45

请教一个问题:关于轮询所有Event_Handle的问题

reactor 的run_event_loop的逻辑如下:

    ACE_thread_t thread_t = ACE_OS::thr_self ();
    this->owner (ACE_OS::thr_self ());
    while (true)
    {
      int result = this->implementation_->handle_events ();

      if (eh != 0 && (*eh)(this))
            continue;
      else if (result == -1 && this->implementation_->deactivated ())
            return 0;
      else if (result == -1)
            return -1;
    }

    ACE_NOTREACHED (return 0;)

我想实现一个功能,在每次handle_events (),之后轮询每个注册在reactor上的event_loop,请问高人,如何实现。

winston 发表于 2008-4-16 17:48:04

没明白你的用意?

bowei_wang 发表于 2008-4-17 07:55:12

就是说要实现如下功能:
while (true)
    {
      int result = this->implementation_->handle_events ();

      ///轮询注册在本reactor中的每一个有效的CEvent_Handler
      for (each CEvent_Handler which is registered in this reactor)
      {
               DoSomething(CEvent_Handler *pEvent_Handler);
      }

      if (eh != 0 && (*eh)(this))
            continue;
      else if (result == -1 && this->implementation_->deactivated ())
            return 0;
      else if (result == -1)
            return -1;
    }
页: [1]
查看完整版本: 请教一个问题:关于轮询所有Event_Handle的问题