You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2010/05/28 15:37:22 UTC
svn commit: r949176 - /qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
Author: gsim
Date: Fri May 28 13:37:22 2010
New Revision: 949176
URL: http://svn.apache.org/viewvc?rev=949176&view=rev
Log:
QPID-2598: Prevent exit hang on windows (at the expense of intermittent leak on exit under linux)
Modified:
qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp?rev=949176&r1=949175&r2=949176&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Fri May 28 13:37:22 2010
@@ -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();
}
}
};
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org