mirror of https://github.com/AxioDL/amuse.git
Common: Less strict memory ordering requirements for IObj
Applies the same relaxed restrictions as applied to boo in4d91a1b3c3
and84f62a0f2c
This commit is contained in:
parent
c46bb3f72b
commit
a8f4c1d34a
|
@ -150,10 +150,12 @@ protected:
|
|||
virtual ~IObj() = default;
|
||||
|
||||
public:
|
||||
void increment() noexcept { m_refCount++; }
|
||||
void increment() noexcept { m_refCount.fetch_add(std::memory_order_relaxed); }
|
||||
void decrement() noexcept {
|
||||
if (m_refCount.fetch_sub(1) == 1)
|
||||
if (m_refCount.fetch_sub(1, std::memory_order_release) == 1) {
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -373,7 +375,7 @@ constexpr T clamp(T a, T val, T b) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr T ClampFull(float in) {
|
||||
constexpr T ClampFull(float in) noexcept {
|
||||
if (std::is_floating_point<T>()) {
|
||||
return in;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue