qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r995136 - in /qpid/trunk/qpid/cpp/src/qpid/sys/rdma: RdmaIO.cpp RdmaIO.h
Date Wed, 08 Sep 2010 16:49:19 GMT
Author: astitcher
Date: Wed Sep  8 16:49:19 2010
New Revision: 995136

URL: http://svn.apache.org/viewvc?rev=995136&view=rev
Log:
Coalesce checking for the drained and stopped conditions into a single
function

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp?rev=995136&r1=995135&r2=995136&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Wed Sep  8 16:49:19 2010
@@ -254,9 +254,8 @@ namespace Rdma {
                 return;
             case EXIT:
                 // If we just processed completions we might need to delete ourselves
-                if (notifyCallback && outstandingWrites == 0) {
-                    doStoppedCallback();
-                }
+                // TODO: XXX: can we delete ourselves correctly in notifyPendingWrite()?
+                checkDrainedStopped();
                 return;
             }
         } while (true);
@@ -321,20 +320,8 @@ namespace Rdma {
             } while (!state.boolCompareAndSwap(oldState, newState));
         }
 
-        // If we've got all the write confirmations and we're draining
-        // We might get deleted in the drained callback so return immediately
-        if (draining) {
-            if (outstandingWrites == 0) {
-                 draining = false;
-                 doDrainedCallback();
-            }
-            return;
-        }
-
-        // We might need to delete ourselves
-        if (notifyCallback && outstandingWrites == 0) {
-            doStoppedCallback();
-        }
+        // We might delete ourselves in here so return immediately
+	checkDrainedStopped();
     }
 
     void AsynchIO::processCompletions() {
@@ -448,6 +435,23 @@ namespace Rdma {
         }
     }
 
+    void AsynchIO::checkDrainedStopped() {
+        // If we've got all the write confirmations and we're draining
+        // We might get deleted in the drained callback so return immediately
+        if (draining) {
+            if (outstandingWrites == 0) {
+                 draining = false;
+                 doDrainedCallback();
+            }
+            return;
+        }
+
+        // We might need to delete ourselves
+        if (notifyCallback && outstandingWrites == 0) {
+            doStoppedCallback();
+        }
+    }
+
     void AsynchIO::doDrainedCallback() {
         NotifyCallback nc;
         nc.swap(notifyCallback);

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h?rev=995136&r1=995135&r2=995136&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.h Wed Sep  8 16:49:19 2010
@@ -101,6 +101,7 @@ namespace Rdma {
         void dataEvent();
         void processCompletions();
         void doWriteCallback();
+        void checkDrainedStopped();
         void doStoppedCallback();
         void doDrainedCallback();
     };



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


Mime
View raw message