diff options
author | Marc Laukien <marc@zeroc.com> | 2003-01-12 23:51:05 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2003-01-12 23:51:05 +0000 |
commit | 801c87bf232fa112b58d52b5d95b1bd6e1a4bfdc (patch) | |
tree | 5736fe1a5339d1e237660444c32ddc7a6e7f093d /cpp/src/Ice/Instance.cpp | |
parent | Fix to display correct error message if imported file isn't found. (diff) | |
download | ice-801c87bf232fa112b58d52b5d95b1bd6e1a4bfdc.tar.bz2 ice-801c87bf232fa112b58d52b5d95b1bd6e1a4bfdc.tar.xz ice-801c87bf232fa112b58d52b5d95b1bd6e1a4bfdc.zip |
fixed deadlock
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 75894b607bf..19372b51a64 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -507,6 +507,9 @@ IceInternal::Instance::destroy() _outgoingConnectionFactory->destroy(); _outgoingConnectionFactory->waitUntilFinished(); + ThreadPoolPtr serverThreadPool; + ThreadPoolPtr clientThreadPool; + { IceUtil::RecMutex::Lock sync(*this); @@ -516,15 +519,13 @@ IceInternal::Instance::destroy() if(_serverThreadPool) { _serverThreadPool->destroy(); - _serverThreadPool->joinWithAllThreads(); - _serverThreadPool = 0; + std::swap(_serverThreadPool, serverThreadPool); } if(_clientThreadPool) { _clientThreadPool->destroy(); - _clientThreadPool->joinWithAllThreads(); - _clientThreadPool = 0; + std::swap(_clientThreadPool, clientThreadPool); } _servantFactoryManager->destroy(); @@ -558,4 +559,16 @@ IceInternal::Instance::destroy() _destroyed = true; } + + // + // Join with the thread pool threads outside the synchronization. + // + if(clientThreadPool) + { + clientThreadPool->joinWithAllThreads(); + } + if(serverThreadPool) + { + serverThreadPool->joinWithAllThreads(); + } } |