最近在看ace_dev_poll_reactor的源代码,比较郁闷的是发现现在公司看到的和家里看的竟然有大差异。
于是比较了ACE的svn上的和公司使用的版本。发现09年6月之前还是蛮稳定的,
从这个时间点开始ace_dev_poll_reactor的改动还是蛮大的。
最大的莫过于对Epoll的使用时之前是一次性所有活动的多个句柄,目前为一次获取一个活动的句柄。
这与上次在wishel发Epoll Proactor时提到的是一样的。于是比较了svn的修改日志。
下面是changelog里面的说明:
Fri Jun 12 00:45:09 UTC 2009 Steve Huston <shuston@riverace.com>
* ace/Dev_Poll_Reactor.{h cpp inl}: Fixed multi-thread behavior of
ACE_Dev_Poll_Reactor to resolve Bugzilla 2740, 3178, 3188, 3279.
Note that fixing 3178 involved adding the manual-resume behavior from
ACE_TP_Reactor which was easy after the other fixes. Essentially
what was done is:
- Change epoll_wait() from returning all ready events to just one.
- Registered events now include the EPOLLONESHOT flag, so once
an event is delivered for a handle, no more will be until
epoll_ctl() is called again to reset the events.
This has the effect of suspending handlers around I/O upcalls and
preventing registration changes from happening while another thread
is waiting for events.
* tests/Reactor_Dispatch_Order_Test.cpp:
* tests/Reactor_Dispatch_Order_Test_Dev_Poll.cpp:
* tests/Refcounted_Event_Handler_Test_DevPoll.cpp:
When registering the test handle for events, register for read and
write, not everything. Registering for everything leaves 'connect'
set when 'write' is removed, but they both map to the same event
on non-Windows reactors.
For the _Dev_Poll test, remove the BSD, VxWorks, Lynx-only case for
removing write-mask - this should always be done.
* tests/MT_Reactor_Upcall_Test.cpp: When setting up the
ACE_Dev_Poll_Reactor, set the restart flag.
* tests/Bug_2740_Regression_Test.cpp: Tweaks for more informative
logging and remove false-fails on peer socket closes.
* tests/run_test.lst: Removed !FIXED_BUGS_ONLY from
Bug_2740_Regression_Test.