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 2011/06/17 20:35:48 UTC

svn commit: r1136971 - in /qpid/trunk/qpid/cpp/src/qpid: broker/Queue.cpp sys/AtomicValue_gcc.h

Author: aconway
Date: Fri Jun 17 18:35:48 2011
New Revision: 1136971

URL: http://svn.apache.org/viewvc?rev=1136971&view=rev
Log:
NO-JIRA: Fix compile error on windows due to assigning an AtomicValue.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
    qpid/trunk/qpid/cpp/src/qpid/sys/AtomicValue_gcc.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1136971&r1=1136970&r2=1136971&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Fri Jun 17 18:35:48 2011
@@ -1204,7 +1204,7 @@ const Broker* Queue::getBroker()
 }
 
 void Queue::setDequeueSincePurge(uint32_t value) {
-    dequeueSincePurge = AtomicValue<uint32_t>(value);
+    dequeueSincePurge = value;
 }
 
 

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/AtomicValue_gcc.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/AtomicValue_gcc.h?rev=1136971&r1=1136970&r2=1136971&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/AtomicValue_gcc.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/AtomicValue_gcc.h Fri Jun 17 18:35:48 2011
@@ -10,9 +10,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -39,6 +39,9 @@ class AtomicValue
   public:
     AtomicValue(T init=0) : value(init) {}
 
+    // Not atomic. Don't call concurrently with atomic ops.
+    AtomicValue<T>& operator=(T newValue) { value = newValue; return *this; }
+
     // Update and return new value.
     inline T operator+=(T n) { return __sync_add_and_fetch(&value, n); }
     inline T operator-=(T n) { return __sync_sub_and_fetch(&value, n); }
@@ -54,11 +57,11 @@ class AtomicValue
     /** If current value == testval then set to newval. Returns the old value. */
     T valueCompareAndSwap(T testval, T newval) { return __sync_val_compare_and_swap(&value, testval, newval); }
 
-    /** If current value == testval then set to newval. Returns true if the swap was performed. */    
+    /** If current value == testval then set to newval. Returns true if the swap was performed. */
     bool boolCompareAndSwap(T testval, T newval) { return __sync_bool_compare_and_swap(&value, testval, newval); }
 
     T get() const { return const_cast<AtomicValue<T>*>(this)->fetchAndAdd(static_cast<T>(0)); }
-        
+
   private:
     T value;
 };



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