diff --git a/LibCarla/source/carla/AtomicSharedPtr.h b/LibCarla/source/carla/AtomicSharedPtr.h index 2b87fa851..556877db8 100644 --- a/LibCarla/source/carla/AtomicSharedPtr.h +++ b/LibCarla/source/carla/AtomicSharedPtr.h @@ -7,7 +7,6 @@ #pragma once #include -#include namespace carla { @@ -26,7 +25,7 @@ namespace carla { AtomicSharedPtr(AtomicSharedPtr &&) = delete; void store(std::shared_ptr ptr) noexcept { - _ptr.store(ptr, std::memory_order_release); + std::atomic_store_explicit(&_ptr, ptr, std::memory_order_release); } void reset(std::shared_ptr ptr = nullptr) noexcept { @@ -34,12 +33,13 @@ namespace carla { } std::shared_ptr load() const noexcept { - return _ptr.load(std::memory_order_acquire); + return std::atomic_load_explicit(&_ptr, std::memory_order_acquire); } bool compare_exchange(std::shared_ptr *expected, std::shared_ptr desired) noexcept { - return _ptr.compare_exchange_strong( - *expected, + return std::atomic_compare_exchange_strong_explicit( + &_ptr, + expected, desired, std::memory_order_acq_rel, std::memory_order_acq_rel); @@ -59,7 +59,7 @@ namespace carla { private: - std::atomic> _ptr; + std::shared_ptr _ptr; }; } // namespace carla