Chinaunix首页 | 论坛 | 博客
  • 博客访问: 802847
  • 博文数量: 330
  • 博客积分: 9641
  • 博客等级: 中将
  • 技术积分: 3181
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-19 14:41
文章分类

全部博文(330)

文章存档

2012年(17)

2011年(135)

2010年(85)

2009年(57)

2008年(36)

我的朋友

分类: C/C++

2010-12-16 15:03:52

ACE_Reactor::instance()->run_reactor_event_loop() 放在主线程中,定时器就正常;放在子线程中,定时器就不起作用。

解决方法:
set the owner of the reactor to the identity of the thread that runs the event loop

int svc()
{

    int nRet = 0;
    /* select_reactor 可能在阻塞过程中被信号中断(errno=4) */
    while(ACE_Reactor::instance()->reactor_event_loop_done() == 0)
    {
        ACE_Reactor::instance()->owner( ACE_OS::thr_self() );
        nRet = ACE_Reactor::instance()->run_reactor_event_loop();
        if(nRet >= 0)
            break;
    }
}

阅读(2280) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~