提几个问题:
1.看书上与很多资料上都提到ACE_WFMO_Reactor,对写的处理严重依赖于windows平台对于写事件的定义。之前我都是一直调用send放心的发的,汗~~。那么我想知道,如果直接send失败了handle_output会被触发,然后怎么做呢?继续发?如果缓冲区还是不够大,仍然发送失败呢,那么就一直的重复发下去,直到成功么?尽管这种情况现实中,未必会遇到。
2.ACE_TP_Reactor的并发同步问题,貌似楼主提到的和书上说的有差异,书上的意思是说可以并发的排放i/o回调与定时器事件,只是对于相同句柄的I/O在多线程时进行序列化。我最近再读ACE_TP_Reactor 的源代码,对一些细节问题还是有不少疑惑的。
Concurrency considerations. Multiple threads running an ACE_TP_Reactor event loop can process events concurrently on different handles. They can also dispatch timeout and I/O callback methods concurrently on the same event handler. The only serialization in the ACE_TP_Reactor occurs when I/O events occur concurrently on the same handle.
3.如楼主所说ACE_WFMO_Reactor在多线程同步上下了确实很多工夫,读这段代码还是收益匪浅的。
1,“果直接send失败了handle_time_out会被触发”,是说handle_out吧?
我是这样理解的: 可以写的时候一直写,等到出错返回EWOULDBLOCK,就return。等下次可以写的时候,reactor又会dispatch这个handler,接着写。
2,examples\Reactor\TP_Reactor中的readme:
This program demonstrates what we think is a bug in the ACE library. The
affected component is the ACE_TP_Reactor. According to the documentation, the
reactor ensures that only one of the handle_*() methods of an event handler is
called at a time. Tino found this to be not true and I wrote this example
program showing the behavior. I do not exclude the possibility that we are
using the ACE library in an unintended/wrong way. So comments on the code as
well as any other remarks are welcome.