You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2010/03/23 17:29:32 UTC

svn commit: r926650 - /qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp

Author: aconway
Date: Tue Mar 23 16:29:32 2010
New Revision: 926650

URL: http://svn.apache.org/viewvc?rev=926650&view=rev
Log:
Defer Poller creation in ConnectionImpl IOThread from creation to first use.

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=926650&r1=926649&r2=926650&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Tue Mar 23 16:29:32 2010
@@ -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();
         }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org