[ace-users] Svc Termination

Steve Huston shuston at riverace.com
Wed Jun 20 10:38:20 CDT 2007


Hi JR,

Thanks for the PRF.

Could you simply use ACE_Service_Config::fini_svcs() ?

-Steve

--
Steve Huston, Riverace Corporation
Would you like ACE to run great on your platform?
See http://www.riverace.com/sponsor.htm


> -----Original Message-----
> From: ace-users-bounces at cse.wustl.edu 
> [mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of JR Andreassen
> Sent: Wednesday, June 20, 2007 10:46 AM
> Cc: ace-users at cse.wustl.edu
> Subject: [ace-users] Svc Termination
> 
> 
>     ACE VERSION: 5.5.8
>     HOST MACHINE and OPERATING SYSTEM:    Win XP, sp1
>     TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
> 
>     COMPILER NAME AND VERSION:     VC++ 8.0(MSVC 2005) & VC6
> 
>     CONTENTS OF $ACE_ROOT/ace/config.h
> #if !defined (_WIN32_WCE)
> #    define ACE_ENABLE_SWAP_ON_WRITE
> //#    define ACE_DISABLE_SWAP_ON_READ
> #    define ACE_DISABLE_WIN32_ERROR_WINDOWS
> #    define ACE_HAS_STANDARD_CPP_LIBRARY 1
> #endif
> #include "ace/config-win32.h"
> 
> 
>     SYNOPSIS:
> What is the appropriate way to shutdown service.
> 
>     DESCRIPTION:
> I have a set of servicees running. I've had a lot of problems 
> shutting 
> them down gracefully.
> After 5.5.6 things changed for the better, thanks for fixing the
bugs 
> that was driving me mad searching :)
> 
> So, currently I broadcast a MB_HANGUP message then terminate(see 
> broadcastSignal).
> Then :
>         ACE_Reactor::instance()->end_reactor_event_loop();
> 
> My problem is that it doesn't look like fini and deallocation don't 
> allways happen.
> 
> So, my question is this....
> What is the proper sequence of events ???
> 
> I appriciate any help/insight or pointers.
>   Thanks
>     JR
> 
> // --------------------------------------------------------------
> /**
>  * Broadcast Signal(sig) to all tasks
>  * @param sig                Signal to broadcast.
>  * @param ignored_suspended    Flag to determine wether to ignore 
> suspended tasks.
>  * @return int Number ot tasks notified.
>  */
> int broadcastSignal(int signum, int ignored_suspended)
> {    int retVal = 0;
>     ACE_Service_Object* svoTest = NULL;
>     ACE_Event_Handler*    handler = NULL;
>     ACE_Task_Base*        taskbase = NULL;
>     ACE_Service_Repository* svcs_repository = 
> ACE_Service_Repository::instance();
>     const ACE_Service_Type_Impl *    srpI = NULL;
>     const ACE_Service_Type*            srp = NULL;
>     if(svcs_repository != NULL)
>     {   
>         ACE_Service_Repository_Iterator repIter(*svcs_repository, 
> ignored_suspended);
>         for(;repIter.next(srp) > 0;repIter.advance())
>         {
>             srpI = srp->type();
>             if(!ISNULL(srpI))
>             {
>                 svoTest = 
> static_cast<ACE_Service_Object*>(srpI->object());
>                 if(!ISNULL(svoTest))
>                 {
>                     handler = 
> dynamic_cast<ACE_Event_Handler*>(svoTest);
>                     if(!ISNULL(handler))
>                     {    handler->handle_signal(signum);}
>                     Sleep(0);
>                     retVal++;
>                 }
>             }
>         }
>         Sleep(0);
>     }
>     return retVal;
> }
> 
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
> 




More information about the Ace-users mailing list