summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ObjectAdapterI.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-06-06 21:23:29 +0000
committerMarc Laukien <marc@zeroc.com>2002-06-06 21:23:29 +0000
commit18822bbc6abd0bd19abed143aed36a314871e79d (patch)
tree40aa8db0cc4243ccf115b58a4a739661c92345fb /cpp/src/Ice/ObjectAdapterI.cpp
parentfile config was initially added on branch location. (diff)
downloadice-18822bbc6abd0bd19abed143aed36a314871e79d.tar.bz2
ice-18822bbc6abd0bd19abed143aed36a314871e79d.tar.xz
ice-18822bbc6abd0bd19abed143aed36a314871e79d.zip
mutex fix
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterI.cpp')
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 3f8d806b662..a8b37763a34 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -344,10 +344,14 @@ Ice::ObjectAdapterI::addRouter(const RouterPrx& router)
// adapter.
//
ObjectPrx proxy = routerInfo->getServerProxy();
- copy(proxy->__reference()->endpoints.begin(), proxy->__reference()->endpoints.end(),
- back_inserter(_routerEndpoints));
- sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted.
- _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()), _routerEndpoints.end());
+
+ {
+ IceUtil::Mutex::Lock routerEndpointsSync(_routerEndpointsMutex);
+ copy(proxy->__reference()->endpoints.begin(), proxy->__reference()->endpoints.end(),
+ back_inserter(_routerEndpoints));
+ sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted.
+ _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()), _routerEndpoints.end());
+ }
//
// Associate this object adapter with the router. This way,
@@ -482,7 +486,10 @@ Ice::ObjectAdapterI::newProxy(const Identity& ident) const
// any. This way, object references created by this object adapter
// will also point to the router's server proxy endpoints.
//
- copy(_routerEndpoints.begin(), _routerEndpoints.end(), back_inserter(endpoints));
+ {
+ IceUtil::Mutex::Lock routerEndpointsSync(_routerEndpointsMutex);
+ copy(_routerEndpoints.begin(), _routerEndpoints.end(), back_inserter(endpoints));
+ }
//
// Create a reference and return a proxy for this reference.
@@ -515,13 +522,8 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
}
}
- //
- // Must be synchronized, because _routerEndpoints is not
- // immutable, and because this operation is called unsynchronized
- // from ObjectAdapterFactory::findObjectAdapter().
- //
{
- IceUtil::Mutex::Lock sync(*this);
+ IceUtil::Mutex::Lock routerEndpointsSync(_routerEndpointsMutex);
//
// Proxies which have at least one endpoint in common with the