From: Anthony Geay Date: Wed, 22 Jul 2015 15:42:59 +0000 (+0200) Subject: Ready to merge in master. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=94f8a6f24f6d92a72b59023d5bba2c716f43f7a3;p=modules%2Fkernel.git Ready to merge in master. --- diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx index de077f7da..ee1f9e07b 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx @@ -202,7 +202,6 @@ void DataScopeServerBase::registerInNS(SALOME::DataScopeServerBase_ptr ptr) std::string fullScopeName(SALOMESDS::DataServerManager::CreateAbsNameInNSFromScopeName(_name)); SALOME_NamingService ns(_orb); ns.Register(ptr,fullScopeName.c_str()); - _ptr_of_this=SALOME::DataScopeServerBase::_duplicate(ptr); } std::string DataScopeServerBase::BuildTmpVarNameFrom(const std::string& varName) diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx index f79e0a92c..db76fbf41 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx @@ -64,8 +64,6 @@ namespace SALOMESDS PyObject *getPickler() const { return _pickler; } PortableServer::POA_var getPOA() const { return _poa; } CORBA::ORB_var getORB() { return _orb; } - //! MTA = Mono thread activated - SALOME::DataScopeServerBase_var getObjectRefMTA() { return _ptr_of_this ;} std::string getScopeNameCpp() const { return _name; } static std::string BuildTmpVarNameFrom(const std::string& varName); public: @@ -83,8 +81,6 @@ namespace SALOMESDS CORBA::ORB_var _orb; std::string _name; std::list< std::pair< SALOME::BasicDataServer_var, BasicDataServer * > > _vars; - // CORBA pointer of this activated by monothread POA _poa. - SALOME::DataScopeServerBase_var _ptr_of_this; static std::size_t COUNTER; }; diff --git a/src/SALOMESDS/SALOMESDS_KeyWaiter.cxx b/src/SALOMESDS/SALOMESDS_KeyWaiter.cxx index 78ca04526..a35830bee 100644 --- a/src/SALOMESDS/SALOMESDS_KeyWaiter.cxx +++ b/src/SALOMESDS/SALOMESDS_KeyWaiter.cxx @@ -74,27 +74,41 @@ PortableServer::POA_var KeyWaiter::getPOA() const return getDSS()->getPOA4KeyWaiter(); } +/*! + * WARNING : here it is the single method that can be invoked in non SINGLE_THREAD POA. + * So take care to do avoid collapses (especially in python). + */ SALOME::ByteVec *KeyWaiter::waitFor() { sem_wait(&_sem); if(!_ze_value) throw Exception("KeyWaiter::waitFor : internal error 1 !"); SALOME::ByteVec *ret(0); - { - SALOME::DataScopeServerBase_var ptr(_var->getFather()->getObjectRefMTA()); - SALOME::DataScopeServerTransaction_var ptr2(SALOME::DataScopeServerTransaction::_narrow(ptr)); - if(CORBA::is_nil(ptr2)) + {// this section is to guarantee that no concurrent threads are doing python stuff at the same time + // Here a pickelization is needed so to guarantee to be alone doing python action the idea is to invoke using monothread POA. + DataScopeServerTransaction *dss(getDSS()); + PortableServer::POA_var poa(dss->getPOA()); + CORBA::Object_var dssPtr(poa->servant_to_reference(dss)); + SALOME::DataScopeServerTransaction_var dssPtr2(SALOME::DataScopeServerTransaction::_narrow(dssPtr)); + if(CORBA::is_nil(dssPtr2)) throw Exception("KeyWaiter::waitFor : internal error 2 !"); CORBA::Object_var thisPtr(getPOA()->servant_to_reference(this)); SALOME::KeyWaiter_var thisPtr2(SALOME::KeyWaiter::_narrow(thisPtr)); - ret=ptr2->waitForMonoThrRev(thisPtr2); + if(CORBA::is_nil(thisPtr2)) + throw Exception("KeyWaiter::waitFor : internal error 3 !"); + ret=dssPtr2->waitForMonoThrRev(thisPtr2);//<- this invokation through SINGLE_THREAD POA here will guarantee thread safety } enforcedRelease(); return ret; } +/*! + * this method is supposed to be performed in alone. + */ SALOME::ByteVec *KeyWaiter::waitForMonoThr() { + if(!_ze_value) + throw Exception("KeyWaiter::waitForMonoThr : no value ! invalid call of this method !"); Py_XINCREF(_ze_value); std::string st(PickelizedPyObjServer::Pickelize(_ze_value,_var->getFather())); return PickelizedPyObjServer::FromCppToByteSeq(st);