]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
use root_poa for activate MPI servant
authorsecher <secher>
Tue, 28 Jul 2009 08:34:15 +0000 (08:34 +0000)
committersecher <secher>
Tue, 28 Jul 2009 08:34:15 +0000 (08:34 +0000)
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/SALOME_MPIContainer.cxx

index 943238344b4eba90beb58664b8d38fb9e24f4694..b486c65c5f64948ffbefa160bff018e0ff73cc16 100644 (file)
@@ -187,12 +187,12 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName)
   else
     {
       Py_ACQUIRE_NEW_THREAD;
-      PyObject *mainmod = PyImport_AddModule("__main__");
+      PyObject *mainmod = PyImport_AddModule((char *)"__main__");
       PyObject *globals = PyModule_GetDict(mainmod);
       PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
       PyObject *result = PyObject_CallMethod(pyCont,
-                                            "import_component",
-                                            "s",componentName);
+                                            (char*)"import_component",
+                                            (char*)"s",componentName);
       int ret= PyInt_AsLong(result);
       SCRUTE(ret);
       Py_RELEASE_NEW_THREAD;
@@ -265,12 +265,12 @@ Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterN
       _containerName + "/" + instanceName;
 
     Py_ACQUIRE_NEW_THREAD;
-    PyObject *mainmod = PyImport_AddModule("__main__");
+    PyObject *mainmod = PyImport_AddModule((char*)"__main__");
     PyObject *globals = PyModule_GetDict(mainmod);
     PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
     PyObject *result = PyObject_CallMethod(pyCont,
-                                          "create_component_instance",
-                                          "ssl",
+                                          (char*)"create_component_instance",
+                                          (char*)"ssl",
                                           aCompName.c_str(),
                                           instanceName.c_str(),
                                           studyId);
@@ -301,6 +301,7 @@ Engines_MPIContainer_i::Lcreate_component_instance( const char* genericRegisterN
       return iobject._retn();
     }
 
+  return Engines::Component::_nil() ;
 }
 
 Engines::Component_ptr
@@ -591,29 +592,33 @@ void *th_loadcomponentlibrary(void *s)
 {
   thread_st *st = (thread_st*)s;
   (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_component_Library(st->compoName.c_str());
+  return NULL;
 }
 
 void *th_createcomponentinstance(void *s)
 {
   thread_st *st = (thread_st*)s;
   (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId);
+  return NULL;
 }
 
 void *th_loadimpl(void *s)
 {
   thread_st *st = (thread_st*)s;
   (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str());
+  return NULL;
 }
 
 void *th_removeimpl(void *s)
 {
   thread_st *st = (thread_st*)s;
   (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr);
+  return NULL;
 }
 
 void *th_finalizeremoval(void *s)
 {
   thread_st *st = (thread_st*)s;
   (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal();
+  return NULL;
 }
-
index c288ec8cf193051e65e5ad3cc1d52156747b7c2b..7c3b2a672f7dbd184aef708b6497b5726efad06a 100644 (file)
@@ -30,7 +30,6 @@ using namespace std;
 int main(int argc, char* argv[])
 {
   int nbproc, numproc;
-  Engines_MPIContainer_i * myContainer=NULL;
 
   MPI_Init(&argc,&argv);
   MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
@@ -51,39 +50,14 @@ int main(int argc, char* argv[])
     // obtain the root poa manager
     PortableServer::POAManager_var pman = root_poa->the_POAManager();
 
-    // define policy objects     
-    PortableServer::ImplicitActivationPolicy_var implicitActivation =
-      root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
-
-      // default = NO_IMPLICIT_ACTIVATION
-    PortableServer::ThreadPolicy_var threadPolicy =
-      root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
-      // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-
-    // create policy list
-    CORBA::PolicyList policyList;
-    policyList.length(2);
-    policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
-    policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
-    // create the child POA
-    PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
-    PortableServer::POA_var factory_poa =
-      root_poa->create_POA("factory_poa", pman, policyList) ;
-      //with nil_mgr instead of pman, a new POA manager is created with the new POA
-    
-    // destroy policy objects
-    implicitActivation->destroy() ;
-    threadPolicy->destroy() ;
-
-    char *containerName = "";
+    char *containerName = (char *)"";
     if (argc >1) 
     {
        containerName = argv[1] ;
     }
 
     MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
-    new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
+    new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv);
 
     pman->activate();