-#ifdef _MPI_SEQ_CONTAINER_
- #ifdef HAVE_MPI2
- MPI_Init(&argc,&argv);
- #endif
-#endif
-
-#ifndef WIN32
- if(getenv ("DEBUGGER"))
- {
- setsig(SIGSEGV,&Handler);
- setsig(SIGFPE,&Handler);
- std::set_terminate(&terminateHandler);
- std::set_unexpected(&unexpectedHandler);
- }
-#endif
-
- // Initialise the ORB.
- //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
- //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- CORBA::ORB_ptr orb = init(argc , argv ) ;
-
- // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- INFOS_COMPILATION;
- BEGIN_OF(argv[0]);
-
- ASSERT(argc > 1);
- SCRUTE(argv[1]);
-
- KERNEL_PYTHON::init_python(argc,argv);
-
- char *containerName = (char *)"";
- if(argc > 1)
- {
- containerName = argv[1] ;
- }
-
- try
- {
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- ASSERT(!CORBA::is_nil(obj));
- PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
-
- PortableServer::POAManager_var pman = root_poa->the_POAManager();
-
- // add new container to the kill list
-#ifndef WIN32
- std::stringstream aCommand ;
- aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << std::ends ;
- system(aCommand.str().c_str());
-#endif
-
- new Engines_Container_i(orb, root_poa, containerName , argc , argv );
-
- pman->activate();
-
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- timer.ShowAbsolute();
-#endif
-
- HandleServerSideSignals(orb);
-
-//#define MEMORYLEAKS
-#ifdef MEMORYLEAKS
- PyGILState_Ensure();
- //Destroy orb from python (for chasing memory leaks)
- PyRun_SimpleString("from omniORB import CORBA");
- PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
- PyRun_SimpleString("orb.destroy()");
- Py_Finalize();
-#endif
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException");
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch(std::exception& exc)
- {
- INFOS("Caught std::exception - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-
-#ifdef _MPI_SEQ_CONTAINER_
- #ifdef HAVE_MPI2
- MPI_Finalize();
- #endif
-#endif
-
- return 0 ;