diff --git a/base_cpp/include/embb/base/internal/atomic/atomic_base.h b/base_cpp/include/embb/base/internal/atomic/atomic_base.h index 4eb8ad9..54381ec 100644 --- a/base_cpp/include/embb/base/internal/atomic/atomic_base.h +++ b/base_cpp/include/embb/base/internal/atomic/atomic_base.h @@ -59,7 +59,7 @@ class AtomicBase { mutable NativeType AtomicValue; #ifdef EMBB_THREADING_ANALYSIS_MODE - embb_mutex_t internal_mutex; + mutable embb_mutex_t internal_mutex; #endif public: @@ -84,13 +84,13 @@ class AtomicBase { // The members below are documented in atomic.h BaseType operator=(BaseType val); - operator BaseType(); + operator BaseType() const; bool IsLockFree() const; bool IsArithmetic() const; bool IsInteger() const; bool IsPointer() const; void Store(BaseType val); - BaseType Load(); + BaseType Load() const; BaseType Swap(BaseType val); bool CompareAndSwap(BaseType& expected, BaseType desired); }; @@ -118,7 +118,7 @@ inline BaseType AtomicBase::operator=(BaseType val) { } template -inline AtomicBase::operator BaseType() { +inline AtomicBase::operator BaseType() const { return Load(); } @@ -155,7 +155,7 @@ inline void AtomicBase::Store(BaseType val) { } template -inline BaseType AtomicBase::Load() { +inline BaseType AtomicBase::Load() const { BaseType return_value; EMBB_ATOMIC_MUTEX_LOCK(internal_mutex); diff --git a/base_cpp/include/embb/base/internal/atomic/atomic_pointer.h b/base_cpp/include/embb/base/internal/atomic/atomic_pointer.h index 6ea0c26..5a5bcae 100644 --- a/base_cpp/include/embb/base/internal/atomic/atomic_pointer.h +++ b/base_cpp/include/embb/base/internal/atomic/atomic_pointer.h @@ -65,8 +65,8 @@ class AtomicPointer : public AtomicArithmetic { bool IsPointer() const; // The methods below are documented in atomic.h - BaseType* operator->(); - BaseType& operator*(); + BaseType* operator->() const; + BaseType& operator*() const; }; template @@ -93,13 +93,13 @@ inline bool AtomicPointer:: template inline BaseType* AtomicPointer:: - operator->() { + operator->() const { return this->Load(); } template inline BaseType& AtomicPointer:: - operator*() { + operator*() const { return *(this->Load()); }