C++ NPV2 4.2
Years of experimentation and refinement resulted in the following order for event handler dispatching in the ACE_Select_Reactor::handle_events() method:
1. Time-driven events
2. Notifications
3. Output I/O events
4. Exception I/O events
5. Input I/O events
Applications should generally not rely on the order in which the different types of events are dispatched since not all reactor implementations guarantee the same order. For example, the ACE_Dev_Poll_Reactor (page 114) might not dispatch notifications before I/O events.
另外,由于epoll fd自身也是poll/epoll/selectable的(If an epoll file descriptor has events waiting then it will indicate as being readable),所以像ACE_WIN32_Proactor一样,Epoll Proactor也可以和其他reactor(select,dev_poll等)整合在一起在一个线程里跑event loop。具体做法参见C++NPV2 8.5, Sidebar 58: Integrating Proactor and Reactor Events on Windows。
但是和ACE_WIN32_Proactor所不同的是,此时reactor所侦测到的event是ready event而不是complete event,所以将此event传给Epoll Proactor(间接继承自ACE_Event_Handler)后,Epoll Proactor需在handle_input()中调用handle_events_i进行进一步处理而不是调用complete。
这样做的好处是可以在一个线程里同时支持reactor和proactor语义,而不需考虑多线程同步(通常情况reactor和proactor必须在各自单独的线程中跑event loop)。
因此,即使是在windows下用整合reactor和proactor方式写的程序,仍然可以方便的移植到linux。不过如果reactor用的是wfmo的话,需要注意它和select的一些语义差别。