diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-08-18 14:18:24 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-08-18 14:18:24 +0200 |
commit | 04882815fa9d6acda8008befdd11bdd87ba93415 (patch) | |
tree | 119115ac0371118df4a8078acef5cf7d85bbffb3 /cpp/src/Ice/LocatorInfo.cpp | |
parent | Bug 4220 - Ice no longer works with Mono (diff) | |
download | ice-04882815fa9d6acda8008befdd11bdd87ba93415.tar.bz2 ice-04882815fa9d6acda8008befdd11bdd87ba93415.tar.xz ice-04882815fa9d6acda8008befdd11bdd87ba93415.zip |
Better fix for bug 3966 - getLocatorRegistry deadlock
Diffstat (limited to 'cpp/src/Ice/LocatorInfo.cpp')
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 7d866d3da2e..21e00d39ce1 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -514,8 +514,7 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex) IceInternal::LocatorInfo::LocatorInfo(const LocatorPrx& locator, const LocatorTablePtr& table, bool background) : _locator(locator), _table(table), - _background(background), - _waitForRegistry(false) + _background(background) { assert(_locator); assert(_table); @@ -524,7 +523,7 @@ IceInternal::LocatorInfo::LocatorInfo(const LocatorPrx& locator, const LocatorTa void IceInternal::LocatorInfo::destroy() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); _locatorRegistry = 0; _table->clear(); @@ -560,51 +559,26 @@ IceInternal::LocatorInfo::getLocator() const LocatorRegistryPrx IceInternal::LocatorInfo::getLocatorRegistry() { - LocatorPrx locator; { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - - while(_waitForRegistry) - { - wait(); - } - + IceUtil::Mutex::Lock sync(*this); if(_locatorRegistry) { return _locatorRegistry; } - - _waitForRegistry = true; - locator = _locator; } // // Do not make locator calls from within sync. // - LocatorRegistryPrx locatorRegistry; - try - { - locatorRegistry = locator->getRegistry(); - } - catch(const Ice::Exception&) - { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - notifyAll(); - - throw; - } + LocatorRegistryPrx locatorRegistry = _locator->getRegistry(); { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); // // The locator registry can't be located. // _locatorRegistry = LocatorRegistryPrx::uncheckedCast(locatorRegistry->ice_locator(0)); - - _waitForRegistry = false; - notifyAll(); - return _locatorRegistry; } } @@ -880,7 +854,7 @@ IceInternal::LocatorInfo::trace(const string& msg, const ReferencePtr& ref, cons IceInternal::LocatorInfo::RequestPtr IceInternal::LocatorInfo::getAdapterRequest(const ReferencePtr& ref) { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); @@ -901,7 +875,7 @@ IceInternal::LocatorInfo::getAdapterRequest(const ReferencePtr& ref) IceInternal::LocatorInfo::RequestPtr IceInternal::LocatorInfo::getObjectRequest(const ReferencePtr& ref) { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); if(ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); @@ -947,7 +921,7 @@ IceInternal::LocatorInfo::finishRequest(const ReferencePtr& ref, _table->removeAdapterEndpoints(ref->getAdapterId()); } - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); assert(_adapterRequests.find(ref->getAdapterId()) != _adapterRequests.end()); _adapterRequests.erase(ref->getAdapterId()); } @@ -962,7 +936,7 @@ IceInternal::LocatorInfo::finishRequest(const ReferencePtr& ref, _table->removeObjectReference(ref->getIdentity()); } - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + IceUtil::Mutex::Lock sync(*this); assert(_objectRequests.find(ref->getIdentity()) != _objectRequests.end()); _objectRequests.erase(ref->getIdentity()); } |