-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "SALOME_Launcher.hxx"
#include "SALOMESDS_DataServerManager.hxx"
+#include "SALOME_ExternalServerLauncher.hxx"
+#include "SALOME_CPythonHelper.hxx"
#include "utilities.h"
#include <sstream>
#include <iostream>
{
// setsig(SIGSEGV,&Handler);
std::set_terminate(&terminateHandler);
- std::set_unexpected(&unexpectedHandler);
+ //std::set_unexpected(&unexpectedHandler);
}
/* Init libxml
* To avoid memory leak, need to call xmlInitParser in the main thread
PortableServer::POA_var root_poa;
PortableServer::POAManager_var pman;
CORBA::Object_var obj;
-
- CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ CORBA::ORB_var orb;
+ {
+ int myArgc(argc+2);
+ char **myArgv(new char *[myArgc]);
+ for(int i=0;i<argc;i++)
+ myArgv[i]=strdup(argv[i]);
+ myArgv[argc+0]=strdup("-ORBsupportCurrent");
+ myArgv[argc+1]=strdup("0");
+ orb = CORBA::ORB_init( myArgc , myArgv ) ;
+ for(int i=0;i<myArgc;i++)
+ free(myArgv[i]);
+ delete [] myArgv;
+ }
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
INFOS_COMPILATION;
BEGIN_OF(argv[0]);
}
try
{
- SALOME_Launcher *lServ(new SALOME_Launcher(orb,root_poa));
+ CORBA::PolicyList policies;
+ policies.length(1);
+ PortableServer::ThreadPolicy_var threadPol(root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+ policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+ PortableServer::POA_var safePOA = root_poa->create_POA("SingleThreadPOA",pman,policies);
+ threadPol->destroy();
+ SALOME_CPythonHelper cPyh;
+ cPyh.initializePython(argc,argv);
+ SALOME_Launcher *lServ(new SALOME_Launcher(orb,safePOA));
+ lServ->DeclareUsingSalomeSession();
lServ->_remove_ref();
//
- SALOMESDS::DataServerManager *dsm(new SALOMESDS::DataServerManager(argc,argv,orb,root_poa));
+ SALOMESDS::DataServerManager *dsm(new SALOMESDS::DataServerManager(&cPyh,orb,root_poa));
dsm->_remove_ref();
//
+ SALOME_ExternalServerLauncher *esm(new SALOME_ExternalServerLauncher(&cPyh,orb,safePOA));
+ esm->_remove_ref();
+ //
orb->run();
orb->destroy();
}