From: ribes Date: Wed, 25 Mar 2009 11:00:22 +0000 (+0000) Subject: - Ajout d'une fonction pour la cohérence du numéro des instances de composants X-Git-Tag: new_launcher_alpha_091119~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=564e773476bc5f458b74c9a2ab7dd6fe9e320beb;p=modules%2Fkernel.git - Ajout d'une fonction pour la cohérence du numéro des instances de composants dans le container parallèle --- diff --git a/idl/SALOME_PACOExtension.idl b/idl/SALOME_PACOExtension.idl index eb7a5d0cd..f75da0ccf 100644 --- a/idl/SALOME_PACOExtension.idl +++ b/idl/SALOME_PACOExtension.idl @@ -45,6 +45,8 @@ module Engines void create_paco_component_node_instance(in string registeredName, in string proxy_containerName, in long studyId) raises(SALOME::SALOME_Exception); + + void updateInstanceNumber(); }; /*--------------------------------------------------------------------------------------------*/ diff --git a/idl/SALOME_PACOExtension.xml b/idl/SALOME_PACOExtension.xml index 2c7a0593a..c642410b6 100644 --- a/idl/SALOME_PACOExtension.xml +++ b/idl/SALOME_PACOExtension.xml @@ -36,6 +36,10 @@ PACO_Container + + updateInstanceNumber + distributed + Parallel_DSC diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx index 60c35a3a4..f6eb80b37 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx @@ -275,9 +275,10 @@ Container_proxy_impl_final::create_component_instance(const char* componentName, // If it is a sequential component if (_libtype_map[aCompName] == "seq") { - _numInstanceMutex.lock() ; // lock on the instance number - _numInstance++ ; - _numInstanceMutex.unlock() ; + _numInstanceMutex.lock(); // lock on the instance number + _numInstance++; + _numInstanceMutex.unlock(); + Engines::PACO_Container_proxy_impl::updateInstanceNumber(); return Engines::Container_proxy_impl::create_component_instance(componentName, studyId); } diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 341e09a9e..65cea7871 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -902,9 +902,10 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co void* handle = _library_map[impl_name]; _numInstanceMutex.lock() ; // lock on the instance number _numInstance++ ; + int numInstance = _numInstance ; _numInstanceMutex.unlock() ; char aNumI[12]; - sprintf( aNumI , "%d" , _numInstance ) ; + sprintf( aNumI , "%d" , numInstance ) ; string instanceName = aCompName + "_inst_" + aNumI ; // Step 1 : Get proxy ! @@ -914,6 +915,7 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co if (CORBA::is_nil(obj_proxy)) { INFOS("Proxy reference from NamingService is nil !"); + INFOS("Proxy name was : " << component_registerName); SALOME::ExceptionStruct es; es.type = SALOME::INTERNAL_ERROR; es.text = "Proxy reference from NamingService is nil !"; @@ -1019,6 +1021,22 @@ bool Engines_Parallel_Container_i::isPythonContainer(const char* ContainerName) return ret; } + +// Cette méthode permet de tenir à jour le compteur des +// instances pour le container parallèle. +// En effet losrque l'on charge un composant séquentielle seul +// le compteur du noeud 0 est augmenté, il faut donc tenir les autres +// noeuds à jour. +void +Engines_Parallel_Container_i::updateInstanceNumber() +{ + if (getMyRank() != 0) + { + _numInstanceMutex.lock(); + _numInstance++; + _numInstanceMutex.unlock(); + } +} //============================================================================= /*! * diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 877cc1e07..a3a8083bf 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -90,6 +90,8 @@ public: const char* proxy_containerName, CORBA::Long studyId); // 0 for multiStudy + void updateInstanceNumber(); + void remove_impl(Engines::Component_ptr component_i); void finalize_removal();