找回密码
 用户注册

QQ登录

只需一步,快速开始

查看: 3677|回复: 2

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

[复制链接]
发表于 2008-4-16 16:13:45 | 显示全部楼层 |阅读模式
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,请问高人,如何实现。
发表于 2008-4-16 17:48:04 | 显示全部楼层
没明白你的用意?
 楼主| 发表于 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;
    }
您需要登录后才可以回帖 登录 | 用户注册

本版积分规则

Archiver|手机版|小黑屋|ACE Developer ( 京ICP备06055248号 )

GMT+8, 2025-2-23 20:26 , Processed in 0.016915 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表