From 57a9c89db655e6e3886b2086a72487b2e8b4b271 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 29 Jan 2015 09:54:50 +0100 Subject: [PATCH] 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. --- src/Registry/SALOME_Registry_Server.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. -- 2.39.2