Salome HOME
PR: mergefrom_BR_CCRT_11Nov04
[modules/kernel.git] / src / Container / SALOME_Container.cxx
index d8cd500a3994ab7d42aa09b50e1e1c9c962f8290..02b2acce44006dfa262a76052d749ad8d235602e 100644 (file)
 #include "SALOME_NamingService.hxx"
 #include "SALOME_Container_i.hxx"
 #include "utilities.h"
+#include "LocalTraceCollector.hxx"
 
 #ifdef CHECKTIME
 #include <Utils_Timer.hxx>
 #endif
 
-#include <Python.h>
+#ifdef HAVE_MPI2
+#include <mpi.h>
+#endif
 
-extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+#include <Python.h>
 
 using namespace std;
 
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+
 static PyMethodDef MethodPyVoidMethod[] = {{ NULL, NULL }};
 
 int main(int argc, char* argv[])
 {
+#ifdef HAVE_MPI2
+  MPI_Init(&argc,&argv);
+#endif
+  // Initialise the ORB.
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  CORBA::ORB_var &orb = init( argc , argv ) ;
+  LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
   INFOS_COMPILATION;
   BEGIN_OF(argv[0]);
     
@@ -58,11 +70,6 @@ int main(int argc, char* argv[])
   Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ;
   
   try{
-    // Initialise the ORB.
-    ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-    ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
-    CORBA::ORB_var &orb = init( argc , argv ) ;
-    
     // Obtain a reference to the root POA.
     // obtain the root poa manager
     //
@@ -199,6 +206,11 @@ int main(int argc, char* argv[])
   }catch(...){
     INFOS("Caught unknown exception.");
   }
+#ifdef HAVE_MPI2
+  MPI_Finalize();
+#endif
   END_OF(argv[0]);
+  delete myThreadTrace;
+  return 0 ;
 }