diff options
author | Gordon Sim <gsim@apache.org> | 2010-05-28 13:37:22 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-05-28 13:37:22 +0000 |
commit | 23ce1e7140ce5dd66788a0af066f3f12893046ac (patch) | |
tree | 692bb5277a6f8ac390363e1a94ff9f55f122d8cb /qpid/cpp/src | |
parent | 96766f5c189156913982a825c013c2c64a905915 (diff) | |
download | qpid-python-23ce1e7140ce5dd66788a0af066f3f12893046ac.tar.gz |
QPID-2598: Prevent exit hang on windows (at the expense of intermittent leak on exit under linux)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@949176 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r-- | qpid/cpp/src/qpid/client/ConnectionImpl.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp index 99f4411977..8848554c94 100644 --- a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp @@ -83,7 +83,6 @@ class IOThread { int ioThreads; int connections; Mutex threadLock; - Condition noConnections; std::vector<Thread> t; Poller::shared_ptr poller_; @@ -103,8 +102,6 @@ public: void sub() { ScopedLock<Mutex> l(threadLock); --connections; - if (connections == 0) - noConnections.notifyAll(); } Poller::shared_ptr poller() const { @@ -128,14 +125,15 @@ public: // and we can't do that before we're unloaded as we can't // restart the Poller after shutting it down ~IOThread() { - ScopedLock<Mutex> l(threadLock); - while (connections > 0) { - noConnections.wait(threadLock); + std::vector<Thread> threads; + { + ScopedLock<Mutex> l(threadLock); + if (poller_) + poller_->shutdown(); + t.swap(threads); } - if (poller_) - poller_->shutdown(); - for (int i=0; i<ioThreads; ++i) { - t[i].join(); + for (std::vector<Thread>::iterator i = threads.begin(); i != threads.end(); ++i) { + i->join(); } } }; |