Salome HOME
CCAR: solve some problems during shutdown BR_PERF V4_1_3 V4_1_3rc2
authorcaremoli <caremoli>
Sun, 8 Jun 2008 13:18:40 +0000 (13:18 +0000)
committercaremoli <caremoli>
Sun, 8 Jun 2008 13:18:40 +0000 (13:18 +0000)
- singletons are deleted at exit (atexit function is called at the beginning of programs)
but order is important. Trace singleton must be destroyed last because MESSAGE
and others are called in destructor of other singletons.
So I have enforced local trace initialization in ATEXIT_ class from Utils directory

- Improve Registry shutdown (called _remove_ref to delete RegistryService object)
- add a delay between shutdown servers and kill omninames in shutdownSalome.py

bin/shutdownSalome.py
src/Registry/RegistryService.hxx
src/Registry/SALOME_Registry_Server.cxx
src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx
src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx

index 49126666210e82e84554975a1194a4569a11cabe..9f9cd6d80e2af93b94a293b47dfbe295d99a720d 100755 (executable)
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
+import time
 import salome
 salome.salome_init()
 salome.lcc.shutdownServers()
-salome.SALOME_LifeCycleCORBA_killOmniNames()
+#give some time to shutdown to complete
+time.sleep(1)
+salome.LifeCycleCORBA.killOmniNames()
index 9b26f41f8b6357a5eb8b6766dfc5d310db3683d6..bc6097fcd92261a1657fb6adeac8af5f11049a01 100644 (file)
@@ -89,7 +89,7 @@ public :
 
        void SessionName( const char *sessionName ) ;
 
-        void SetOrb( CORBA::ORB_ptr orb ) { _orb = orb; return; }
+        void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
 
         void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
 
index 50e608f31761496658512ad5c913176cd015820c..8183340c2b252251d38d3bf74f9a6231b8078d89 100644 (file)
@@ -170,6 +170,7 @@ int main( int argc , char **argv )
       ptrRegistry->SessionName( ptrSessionName ) ;
       ptrRegistry->SetOrb(orb);
       varComponents = ptrRegistry->_this() ;
+      ptrRegistry->_remove_ref(); //let poa manage registryservice deletion
       // The RegistryService must not already exist.
            
       try
index 61239063a4dac4dd4a80954eb95b55071c1008e5..71818af975a245be9137a50ce55a7b884e786fd1 100644 (file)
@@ -36,6 +36,7 @@ extern "C"
 
 # include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
 //# include "utilities.h"
+# include "LocalTraceBufferPool.hxx"
 void Nettoyage();
 
 #ifdef _DEBUG_
@@ -83,6 +84,8 @@ public :
                DESTRUCTEUR_GENERIQUE_::Destructeurs = 
                       new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeur alloue dynamiquement (cf. ci-dessous) ,
                                                                   // il est utilise puis detruit par la fonction Nettoyage
+                //To be sure the trace singleton will be the last one to be destroyed initialize it here before calling atexit
+                LocalTraceBufferPool::instance();
                int cr = atexit( Nettoyage );                      // execute Nettoyage lors de exit, aprs la destruction des donnees statiques !
                assert(cr==0) ;
                ATEXIT_Done = true ;
index 9ae866266b03151f06d82d74ba8ff601adff591e..54e0bcd223e5a538b02a5be2b104e5ecc0eefeeb 100644 (file)
@@ -140,4 +140,4 @@ private :
 };
 
 
-# endif                /* # if !defined( __SINGLETON__H__ ) */
+# endif                /* # if !defined( __DESTRUCTEUR_GENERIQUE__H__ ) */