ACE_TAO icon indicating copy to clipboard operation
ACE_TAO copied to clipboard

How to get the number of event handlers in ACE_Reactor?

Open likema opened this issue 6 years ago • 5 comments

Hi,

I want to get the number of event handlers that are registered in ACE_Reactor.

How to do it?

likema avatar Mar 04 '19 13:03 likema

It looks like size() gives the number of handlers in the reactor, but it's calling the into the reactor implementation, so what that means might depend on the kind of reactor you're using. Also I'm not very familiar with the reactors, so I'm not completely sure if that's the same thing as the number of registered handlers.

iguessthislldo avatar Mar 04 '19 16:03 iguessthislldo

No. I tried ACE_Reactor::size before.

When the implementation of ACE_Reactor is ACE_Select_Reactor, ACE_Reactor::size gives the capacity of the file descriptor table.

likema avatar Mar 04 '19 20:03 likema

Looking at the details I see you are correct. I'm assuming you're using WIndows, because ACE_Hash_Map_Manager_Ex is the container for handlers on windows in the Select Reactor, where as ACE_Array_Base is the container on other platforms. It's strange because on windows it calls ACE_Hash_Map_Manager_Ex::total_size() which is the capacity of the supporting array, while it calls ACE_Array_Base::size(), which give the number of elements on other platforms. It doesn't give a reason for this difference in Select_Reactor_Base.inl. I don't think this is right, it should probably use ACE_Hash_Map_Manager_Ex::current_size(), @jwillemsen do you think this is a bug?

iguessthislldo avatar Mar 05 '19 17:03 iguessthislldo

Currently lacking time to look in more detail at this, maybe @likema can extend one of the unit tests to reproduce this and see what works?

jwillemsen avatar Mar 07 '19 12:03 jwillemsen

I find that no code used ACE_Reactor::size() or ACE_*_Reactor*::size().

They are not consistent:

  • ACE_WFMO_Reactor: the capacity size https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/WFMO_Reactor.inl#L1173-L1178
  • ACE_Select_Reactor: the capacity size https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/Select_Reactor_T.inl#L225-L229 https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/Select_Reactor_Base.inl#L6-L14 https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/Select_Reactor_Base.cpp#L82-L105
  • ACE_Dev_Poll_Reactor: the current size https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/Dev_Poll_Reactor.cpp#L2168-L2172 https://github.com/DOCGroup/ACE_TAO/blob/94ee14a015c942500cbd06316dd07de2b540e6b4/ACE/ace/Dev_Poll_Reactor.inl#L20-L26

Other reactors are base on one of the above.

likema avatar Apr 11 '20 10:04 likema