From 7a843fa13909d54281639bd1b7d2348b853287be Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Wed, 8 Sep 2010 16:49:14 +0000 Subject: Reorder some code for improved intellegibility git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@995135 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 52de923248..6591c6e676 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -94,14 +94,11 @@ namespace Rdma { //qpid::sys::ScopedLock l(stateLock); do { newState = oldState = state.get(); - doReturn = false; - if (oldState != IDLE && oldState != DRAINED) { - doReturn = true; - break; + doReturn = true; + if (oldState == IDLE || oldState == DRAINED) { + doReturn = false; + newState = SHUTDOWN; } - - newState = SHUTDOWN; - } while (!state.boolCompareAndSwap(oldState, newState)); // Ensure we can't get any more callbacks (except for the stopped callback) @@ -125,14 +122,12 @@ namespace Rdma { //qpid::sys::ScopedLock l(stateLock); do { newState = oldState = state.get(); - doReturn = false; - if (oldState != IDLE) { - doReturn = true; - break; - } - - if (outstandingWrites == 0) { - newState = DRAINED; + doReturn = true; + if (oldState == IDLE) { + doReturn = false; + if (outstandingWrites == 0) { + newState = DRAINED; + } } } while (!state.boolCompareAndSwap(oldState, newState)); if (doReturn) { -- cgit v1.2.1