summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ObjectAdapterI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterI.cpp')
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp42
1 files changed, 14 insertions, 28 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index c53b96560a8..dd4fd7ca40c 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -257,45 +257,34 @@ Ice::ObjectAdapterI::deactivate()
void
Ice::ObjectAdapterI::waitForDeactivate()
{
+ vector<IceInternal::IncomingConnectionFactoryPtr> incomingConnectionFactories;
+
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- //
- // First we wait for deactivation of the adapter itself, and for
- // the return of all direct method calls using this adapter.
- //
- while(!_deactivated || _directCount > 0)
+ if(_destroyed)
{
- wait();
+ return;
}
//
- // If some other thread is currently updating the state, we wait
- // until this thread is finished.
+ // Wait for deactivation of the adapter itself, and for
+ // the return of all direct method calls using this adapter.
//
- while(_waitForDeactivate)
+ while(!_deactivated || _directCount > 0)
{
wait();
}
- _waitForDeactivate = true;
+
+ incomingConnectionFactories = _incomingConnectionFactories;
}
//
// Now we wait until all incoming connection factories are
// finished.
//
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(),
Ice::voidMemFun(&IncomingConnectionFactory::waitUntilFinished));
-
- {
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Signal that waiting is complete.
- //
- _waitForDeactivate = false;
- notifyAll();
- }
}
void
@@ -681,7 +670,7 @@ Ice::ObjectAdapterI::decDirectCount()
// Not check for deactivation here!
- assert(_instance); // Must not be called after waitForDeactivate().
+ assert(_instance); // Must not be called after destroy().
assert(_directCount > 0);
if(--_directCount == 0)
@@ -695,11 +684,11 @@ Ice::ObjectAdapterI::getThreadPool() const
{
// No mutex lock necessary, _threadPool and _instance are
// immutable after creation until they are removed in
- // waitForDeactivate().
+ // destroy().
// Not check for deactivation here!
- assert(_instance); // Must not be called after waitForDeactivate().
+ assert(_instance); // Must not be called after destroy().
if(_threadPool)
{
@@ -732,7 +721,6 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
_name(name),
_directCount(0),
_waitForActivate(false),
- _waitForDeactivate(false),
_destroying(false),
_destroyed(false),
_noConfig(noConfig)
@@ -920,8 +908,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
}
catch(...)
{
- deactivate();
- waitForDeactivate();
+ destroy();
__setNoDelete(false);
throw;
}
@@ -948,7 +935,6 @@ Ice::ObjectAdapterI::~ObjectAdapterI()
assert(_incomingConnectionFactories.empty());
assert(_directCount == 0);
assert(!_waitForActivate);
- assert(!_waitForDeactivate);
}
}