summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ObjectAdapterFactory.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-12-18 23:07:40 +0000
committerMarc Laukien <marc@zeroc.com>2002-12-18 23:07:40 +0000
commitf9f84256f069534d1aa2d2da1652648b75e9c4bb (patch)
tree46146ad5b5e204900c0439c57ed2828befa28dd9 /cpp/src/Ice/ObjectAdapterFactory.cpp
parentAppend service name to program name (diff)
downloadice-f9f84256f069534d1aa2d2da1652648b75e9c4bb.tar.bz2
ice-f9f84256f069534d1aa2d2da1652648b75e9c4bb.tar.xz
ice-f9f84256f069534d1aa2d2da1652648b75e9c4bb.zip
fix to waitForShutdown/Deactivate
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterFactory.cpp')
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index b4419cf68ce..eb3715dc38a 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -50,14 +50,26 @@ IceInternal::ObjectAdapterFactory::shutdown()
void
IceInternal::ObjectAdapterFactory::waitForShutdown()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait for the shutdown of the factory itself.
- //
- while(_instance)
{
- wait();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance)
+ {
+ wait();
+ }
+
+ //
+ // If some other thread is currently shutting down, we wait
+ // until this thread is finished.
+ //
+ while(_waitForShutdown)
+ {
+ wait();
+ }
+ _waitForShutdown = true;
}
//
@@ -70,6 +82,16 @@ IceInternal::ObjectAdapterFactory::waitForShutdown()
// We're done, now we can throw away the object adapters.
//
_adapters.clear();
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
+ }
}
ObjectAdapterPtr
@@ -124,7 +146,8 @@ IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy)
IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance,
const CommunicatorPtr& communicator) :
_instance(instance),
- _communicator(communicator)
+ _communicator(communicator),
+ _waitForShutdown(false)
{
}
@@ -133,4 +156,5 @@ IceInternal::ObjectAdapterFactory::~ObjectAdapterFactory()
assert(!_instance);
assert(!_communicator);
assert(_adapters.empty());
+ assert(!_waitForShutdown);
}