Commit 8951053b by Danila Klimenko

Merge branch 'embb471_basecpp_atomic' into development

parents a3244754 e16653a5
...@@ -478,7 +478,7 @@ class Atomic<BaseType*> : public embb::base::internal::atomic:: ...@@ -478,7 +478,7 @@ class Atomic<BaseType*> : public embb::base::internal::atomic::
public: public:
Atomic() : embb::base::internal::atomic:: Atomic() : embb::base::internal::atomic::
AtomicPointer<BaseType, ptrdiff_t, sizeof(BaseType*)>() {} AtomicPointer<BaseType, ptrdiff_t, sizeof(BaseType*)>() {}
Atomic(BaseType* p) : embb::base::internal::atomic:: explicit Atomic(BaseType* p) : embb::base::internal::atomic::
AtomicPointer<BaseType, ptrdiff_t, sizeof(BaseType*)>(p) {} AtomicPointer<BaseType, ptrdiff_t, sizeof(BaseType*)>(p) {}
BaseType* operator=(BaseType* p) { BaseType* operator=(BaseType* p) {
......
...@@ -177,8 +177,7 @@ CompareAndSwap(BaseType& expected, BaseType desired) { ...@@ -177,8 +177,7 @@ CompareAndSwap(BaseType& expected, BaseType desired) {
compare_and_swap(&AtomicValue, &native_expected, native_desired)) !=0 compare_and_swap(&AtomicValue, &native_expected, native_desired)) !=0
? true : false; ? true : false;
if (!return_val) memcpy(&expected, &native_expected, sizeof(expected));
expected = Load();
return return_val; return return_val;
} }
......
...@@ -65,8 +65,8 @@ class AtomicPointer : public AtomicArithmetic<BaseType*, DifferenceType, S> { ...@@ -65,8 +65,8 @@ class AtomicPointer : public AtomicArithmetic<BaseType*, DifferenceType, S> {
bool IsPointer() const; bool IsPointer() const;
// The methods below are documented in atomic.h // The methods below are documented in atomic.h
BaseType* operator->(); BaseType* operator->() const;
BaseType& operator*(); BaseType& operator*() const;
}; };
template<typename BaseType, typename DifferenceType, size_t S> template<typename BaseType, typename DifferenceType, size_t S>
...@@ -93,13 +93,13 @@ inline bool AtomicPointer<BaseType, DifferenceType, S>:: ...@@ -93,13 +93,13 @@ inline bool AtomicPointer<BaseType, DifferenceType, S>::
template<typename BaseType, typename DifferenceType, size_t S> template<typename BaseType, typename DifferenceType, size_t S>
inline BaseType* AtomicPointer<BaseType, DifferenceType, S>:: inline BaseType* AtomicPointer<BaseType, DifferenceType, S>::
operator->() { operator->() const {
return this->Load(); return this->Load();
} }
template<typename BaseType, typename DifferenceType, size_t S> template<typename BaseType, typename DifferenceType, size_t S>
inline BaseType& AtomicPointer<BaseType, DifferenceType, S>:: inline BaseType& AtomicPointer<BaseType, DifferenceType, S>::
operator*() { operator*() const {
return *(this->Load()); return *(this->Load());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment