ACE_Reactor owner() + run_reactor_event_loop()
时间:2010-12-16 来源:LaoLiulaoliu
ACE_Reactor::instance()->run_reactor_event_loop() 放在主线程中,定时器就正常;放在子线程中,定时器就不起作用。
解决方法: set the owner of the reactor to the identity of the thread that runs the event loop
1 int svc()
2 {
3 while(ACE_Reactor::instance()->reactor_event_loop_done() == 0)
4 {
5 ACE_Reactor::instance()->owner( ACE_OS::thr_self() );
6 ACE_Reactor::instance()->run_reactor_event_loop();
7 }
8 }
解决方法: set the owner of the reactor to the identity of the thread that runs the event loop
1 int svc()
2 {
3 while(ACE_Reactor::instance()->reactor_event_loop_done() == 0)
4 {
5 ACE_Reactor::instance()->owner( ACE_OS::thr_self() );
6 ACE_Reactor::instance()->run_reactor_event_loop();
7 }
8 }
相关阅读 更多 +