diff options
| author | Alan Conway <aconway@apache.org> | 2011-06-17 18:35:48 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2011-06-17 18:35:48 +0000 |
| commit | 607d6f916f0c4b1d3fa0c739c374527367c9b400 (patch) | |
| tree | 16612178fe7099481bfbc14664bddb52a37f6731 /cpp/src | |
| parent | 409e4e54ad318816b30fcaed44d2688d644edd46 (diff) | |
| download | qpid-python-607d6f916f0c4b1d3fa0c739c374527367c9b400.tar.gz | |
NO-JIRA: Fix compile error on windows due to assigning an AtomicValue.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1136971 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
| -rw-r--r-- | cpp/src/qpid/broker/Queue.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/AtomicValue_gcc.h | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index cfcd18155e..42923567a2 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -1204,7 +1204,7 @@ const Broker* Queue::getBroker() } void Queue::setDequeueSincePurge(uint32_t value) { - dequeueSincePurge = AtomicValue<uint32_t>(value); + dequeueSincePurge = value; } diff --git a/cpp/src/qpid/sys/AtomicValue_gcc.h b/cpp/src/qpid/sys/AtomicValue_gcc.h index d022b07c1d..724bae422e 100644 --- a/cpp/src/qpid/sys/AtomicValue_gcc.h +++ b/cpp/src/qpid/sys/AtomicValue_gcc.h @@ -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; }; |
