From ad64e7e904fd44b92163466bf6bc444706d0a92b Mon Sep 17 00:00:00 2001 From: secher Date: Tue, 28 Jul 2009 08:34:15 +0000 Subject: [PATCH] use root_poa for activate MPI servant --- src/MPIContainer/MPIContainer_i.cxx | 19 +++++++++------ src/MPIContainer/SALOME_MPIContainer.cxx | 30 ++---------------------- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index 943238344..b486c65c5 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -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; } - diff --git a/src/MPIContainer/SALOME_MPIContainer.cxx b/src/MPIContainer/SALOME_MPIContainer.cxx index c288ec8cf..7c3b2a672 100644 --- a/src/MPIContainer/SALOME_MPIContainer.cxx +++ b/src/MPIContainer/SALOME_MPIContainer.cxx @@ -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(); -- 2.39.2