summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-03-23 16:29:32 +0000
committerAlan Conway <aconway@apache.org>2010-03-23 16:29:32 +0000
commit858769adbb30ff616f39f20c9ecc1a0bd3349205 (patch)
treeb2e94c810be0ae12486328282a35f3538f378f07 /cpp/src
parent9dba1b5fd17bdbc9632aa62e986d57c12458b456 (diff)
downloadqpid-python-858769adbb30ff616f39f20c9ecc1a0bd3349205.tar.gz
Defer Poller creation in ConnectionImpl IOThread from creation to first use.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@926650 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index ec1f4584db..05a781c2d9 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -89,6 +89,8 @@ public:
void add() {
ScopedLock<Mutex> l(threadLock);
++connections;
+ if (!poller_)
+ poller_.reset(new Poller);
if (ioThreads < maxIOThreads) {
QPID_LOG(debug, "Created IO thread: " << ioThreads);
++ioThreads;
@@ -102,14 +104,14 @@ public:
}
Poller::shared_ptr poller() const {
+ assert(poller_);
return poller_;
}
// Here is where the maximum number of threads is set
IOThread(int c) :
ioThreads(0),
- connections(0),
- poller_(new Poller)
+ connections(0)
{
IOThreadOptions options(c);
options.parse(0, 0, QPIDC_CONF_FILE, true);
@@ -122,7 +124,8 @@ public:
// and we can't do that before we're unloaded as we can't
// restart the Poller after shutting it down
~IOThread() {
- poller_->shutdown();
+ if (poller_)
+ poller_->shutdown();
for (int i=0; i<ioThreads; ++i) {
t[i].join();
}