From 33e5588c8d7c359b7b386e31542d0ca55dd25ba3 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 23 Mar 2010 16:29:32 +0000 Subject: Defer Poller creation in ConnectionImpl IOThread from creation to first use. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@926650 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/client/ConnectionImpl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp index ec1f4584db..05a781c2d9 100644 --- a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp @@ -89,6 +89,8 @@ public: void add() { ScopedLock 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