From: Anthony Geay Date: Thu, 29 Jan 2015 08:54:50 +0000 (+0100) Subject: Bug correction. Regitry server must be thread safe ; When components are instanciated... X-Git-Tag: V7_6_0a1~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0dd6b1d75afdbc1045cfb188832450041b5048ba;p=modules%2Fkernel.git Bug correction. Regitry server must be thread safe ; When components are instanciated and loaded simultaneously registry->add can be invoked simultaneously. POA of Registry::Components is now SINGLE_THREAD. --- diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 4ee6ea453..d8adcd7dc 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -170,7 +170,17 @@ int main( int argc , char **argv ) RegistryService *ptrRegistry = SINGLETON_::Instance() ; ptrRegistry->SessionName( ptrSessionName ) ; ptrRegistry->SetOrb(orb); - varComponents = ptrRegistry->_this() ; + // + CORBA::PolicyList policies; + policies.length(1); + PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); + PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",manager,policies)); + threadPol->destroy(); + // + PortableServer::ObjectId_var id(poa2->activate_object(ptrRegistry)); + CORBA::Object_var pipo=poa2->id_to_reference(id); + varComponents = Registry::Components::_narrow(pipo) ; ptrRegistry->_remove_ref(); //let poa manage registryservice deletion // The RegistryService must not already exist.