activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r756505 - /activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp
Date Fri, 20 Mar 2009 15:03:16 GMT
Author: tabish
Date: Fri Mar 20 15:03:15 2009
New Revision: 756505

URL: http://svn.apache.org/viewvc?rev=756505&view=rev
Log:
First attempt at fix for threading issue when closing IOTransport in unit tests that stress
start / close functionality.

Modified:
    activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp

Modified: activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp?rev=756505&r1=756504&r2=756505&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/io/BlockingByteArrayInputStream.cpp Fri Mar
20 15:03:15 2009
@@ -125,17 +125,18 @@
 
         std::size_t ix = 0;
 
-        for( ; ix < bufferSize && !closing; ++ix, ++pos)
-        {
-            if(pos == this->buffer.end())
-            {
+        for( ; ix < bufferSize && !closing; ++ix ) {
+            
+			if( pos == this->buffer.end() ) {
                 // Wait for more data to come in.
                 wait();
             }
 
-            if( !closing ){
+            if( !closing && pos != this->buffer.end() ){
                 buffer[ix + offset] = *(pos);
             }
+
+			++pos;
         }
 
         if( closing ){



Mime
View raw message