[Ace-users] [ace-users] server gracefully shutdown using TP_Reactor

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Thu Jan 24 15:12:33 CST 2008


To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form
(PRF), which is in


or in


in older versions of ACE+TAO.  Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness.  If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers



>I'm writing a gateway application using TP_Reactor, and I encounter a
>problem during shutdown.
>When the reactor calls end_reactor_event_loop (); it causes  a calling
>to handle_close() of all svc_handlers.
>the problem is, that if a handler (lets call it H1) was running at
>that same moment on some other handler (like handle_input()) its
>handle_close() will be called only AFTER it returns from the current
>but, at the same time H2 enter its handle_close() and deletes itself.
>The problem is, that handler H1 has a pointer to H2 and it tries to
>use it after H2 was deleted.
>I tried to find out a resolution for this, and i thought that in this
>case i need to be sure that all handlers are not in the middle of
>running on other handle_*. i tried to use reactor->suspend() but still
>the H1 handler will get to suspend list AFTER it returns from it
>current handle_*.
>So, i thought, maybe i can do something else, like cause the reactor
>to call to ALL the handlers registered to it to handle_exception (as
>far i as understand, handle
>_exception will be called in concurency to handle_input), and do
>something that will cause handle_input() to wxit right away (like
>setting a flag, close its socket, deactivate its queue)
>So my questions are:
>1) Does this approach right? Does there any other way?
>2) i didnt find a way to cause the reactor to send event too all the
>handlers it contains (i dont have pointers to all handlers)
>I really appritiate if you could help me.

Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu

More information about the Ace-users mailing list