ACE_Reactor initialization

I faced the problem when ACE_Reactor::run_reactor_event_loop() returned -1 with errno == 0.

This happened only on Linux while Windows code works pretty fine.

My ACE version is 5.4.6 and Linux is Red Hat with gcc 3.2.3

So as turns out that if ace reactor is used in its very default way:

   ACE_Reactor reactor;
    ...
   reactor.register_handler(hSocket, &pHandler, ACE_Event_Handler::READ_MASK);
    ...
   reactor.run_reactor_event_loop();

When reactor is used in this way, ACE internally creates instance of implementation class.
The type of implementation class depends on some compile time flags and on used platform.
For example, on Windows default implementation will be ACE_WFMO_Reactor and on Linux this is ACE_Select_Reactor.
There are several other reactor implementations.
To use specific implementation one can do the following.

The simplified code looks like:

ACE_TP_Reactor m_TPReactor;
ACE_Reactor m_Reactor(&m_TPReactor);


In such way you can tune ACE_Reactor to use any implementation class.
So what happened on my system is that the actual implementation ACE_Select_Reactor is returning -1 from run_reactor_event_loop. This might be already fixed by ACE developers.
When I changed implementation to ACE_TP_Reactor it worked fine on both platforms.

Leave a Reply