我发现了两种在 ace 中结束反应器事件循环的方法:
1. ACE_Reactor::instance()->end_reactor_event_loop();
2. ACE_Reactor::instance()->close()
它们之间有什么区别?我应该使用哪个?
Depends on what you want to do:
Take a look at this documentation
Basically the difference between the 2 is:
end_reactor_event_loop
stops processing of the messages by the reactor but doesn't free resources and doesn't drop any messages already in the queues.
close
on the other hand will do above and release all the resources associated with the implementation of the ACE_Reactor::intance()
, consequently dropping messages deleting all sockets and handlers associated with the reactor, etc.
So depending on what you are doing you can choose one or the other beyond that you would need to provide more details.