summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-11-22 20:16:40 +0000
committerMarc Laukien <marc@zeroc.com>2002-11-22 20:16:40 +0000
commit97abd04f63423218fcf9e39b99879eedf67ff94c (patch)
tree83312b8531056adce84a01187823b44eaa825ebc /cpp/src
parentFixed incorrect comment about lock upgrade. (diff)
downloadice-97abd04f63423218fcf9e39b99879eedf67ff94c.tar.bz2
ice-97abd04f63423218fcf9e39b99879eedf67ff94c.tar.xz
ice-97abd04f63423218fcf9e39b99879eedf67ff94c.zip
destroy fix
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp86
1 files changed, 46 insertions, 40 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index e7e49c4a5fc..7f95182d365 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -489,7 +489,6 @@ IceInternal::Instance::destroy()
{
ThreadPoolPtr clientThreadPool;
ThreadPoolPtr serverThreadPool;
- PluginManagerPtr pluginManager;
{
IceUtil::RecMutex::Lock sync(*this);
@@ -508,6 +507,47 @@ IceInternal::Instance::destroy()
_objectAdapterFactory = 0;
}
+ if(_outgoingConnectionFactory)
+ {
+ _outgoingConnectionFactory->destroy();
+ _outgoingConnectionFactory = 0;
+ }
+
+ //
+ // We destroy the thread pool outside the thread
+ // synchronization.
+ //
+ clientThreadPool = _clientThreadPool;
+ _clientThreadPool = 0;
+ serverThreadPool = _serverThreadPool;
+ _serverThreadPool = 0;
+ }
+
+ //
+ // We must destroy the outgoing connection factory before we
+ // destroy the client thread pool.
+ //
+ if(clientThreadPool)
+ {
+ clientThreadPool->waitUntilFinished();
+ clientThreadPool->destroy();
+ clientThreadPool->joinWithAllThreads();
+ }
+
+ //
+ // We must destroy the object adapter factory before we destroy
+ // the server thread pool.
+ //
+ if(serverThreadPool)
+ {
+ serverThreadPool->waitUntilFinished();
+ serverThreadPool->destroy();
+ serverThreadPool->joinWithAllThreads();
+ }
+
+ {
+ IceUtil::RecMutex::Lock sync(*this);
+
if(_servantFactoryManager)
{
_servantFactoryManager->destroy();
@@ -533,12 +573,6 @@ IceInternal::Instance::destroy()
_proxyFactory = 0;
}
- if(_outgoingConnectionFactory)
- {
- _outgoingConnectionFactory->destroy();
- _outgoingConnectionFactory = 0;
- }
-
if(_routerManager)
{
_routerManager->destroy();
@@ -557,20 +591,11 @@ IceInternal::Instance::destroy()
_endpointFactoryManager = 0;
}
- //
- // We destroy the thread pool outside the thread
- // synchronization.
- //
- clientThreadPool = _clientThreadPool;
- _clientThreadPool = 0;
- serverThreadPool = _serverThreadPool;
- _serverThreadPool = 0;
-
- //
- // We destroy the plugin manager after the thread pools.
- //
- pluginManager = _pluginManager;
- _pluginManager = 0;
+ if(_pluginManager)
+ {
+ _pluginManager->destroy();
+ _pluginManager = 0;
+ }
if(_dynamicLibraryList)
{
@@ -579,23 +604,4 @@ IceInternal::Instance::destroy()
_dynamicLibraryList = 0;
}
}
-
- if(clientThreadPool)
- {
- clientThreadPool->waitUntilFinished();
- clientThreadPool->destroy();
- clientThreadPool->joinWithAllThreads();
- }
-
- if(serverThreadPool)
- {
- serverThreadPool->waitUntilFinished();
- serverThreadPool->destroy();
- serverThreadPool->joinWithAllThreads();
- }
-
- if(pluginManager)
- {
- pluginManager->destroy();
- }
}