summaryrefslogtreecommitdiff
path: root/cpp
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
parentFixed incorrect comment about lock upgrade. (diff)
downloadice-97abd04f63423218fcf9e39b99879eedf67ff94c.tar.bz2
ice-97abd04f63423218fcf9e39b99879eedf67ff94c.tar.xz
ice-97abd04f63423218fcf9e39b99879eedf67ff94c.zip
destroy fix
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp86
-rwxr-xr-xcpp/test/Freeze/cursor/run.py3
-rwxr-xr-xcpp/test/IceXML/encoding/run.py2
3 files changed, 48 insertions, 43 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();
- }
}
diff --git a/cpp/test/Freeze/cursor/run.py b/cpp/test/Freeze/cursor/run.py
index 1d3a3bf9f6d..d9cdbcd0b2e 100755
--- a/cpp/test/Freeze/cursor/run.py
+++ b/cpp/test/Freeze/cursor/run.py
@@ -32,10 +32,9 @@ dbdir = os.path.join(testdir, "db")
TestUtil.cleanDbDir(dbdir)
client = os.path.join(testdir, "client")
-clientOptions = ' ' + testdir;
print "starting client...",
-clientPipe = os.popen(client + clientOptions)
+clientPipe = os.popen(client + TestUtil.clientOptions + " " + testdir)
print "ok"
for output in clientPipe.xreadlines():
diff --git a/cpp/test/IceXML/encoding/run.py b/cpp/test/IceXML/encoding/run.py
index 51a630de65c..f9465907ece 100755
--- a/cpp/test/IceXML/encoding/run.py
+++ b/cpp/test/IceXML/encoding/run.py
@@ -31,7 +31,7 @@ testdir = os.path.join(toplevel, "test", name)
client = os.path.join(testdir, "client")
print "starting client...",
-clientPipe = os.popen(client + " " + testdir)
+clientPipe = os.popen(client + TestUtil.clientOptions + " " + testdir)
print "ok"
for output in clientPipe.xreadlines():