diff --git a/cpp/platform/impl/windows/atomic_boolean.h b/cpp/platform/impl/windows/atomic_boolean.h index 60c07d67..ea040359 100644 --- a/cpp/platform/impl/windows/atomic_boolean.h +++ b/cpp/platform/impl/windows/atomic_boolean.h @@ -15,10 +15,10 @@ #ifndef PLATFORM_IMPL_WINDOWS_ATOMIC_BOOLEAN_H_ #define PLATFORM_IMPL_WINDOWS_ATOMIC_BOOLEAN_H_ -#include "platform/api/atomic_boolean.h" - #include +#include "platform/api/atomic_boolean.h" + namespace location { namespace nearby { namespace windows { @@ -26,24 +26,15 @@ namespace windows { // A boolean value that may be updated atomically. class AtomicBoolean : public api::AtomicBoolean { public: - // TODO(b/184975123): replace with real implementation. ~AtomicBoolean() override = default; // Atomically read and return current value. bool Get() const override { - // TODO(b/184975123): replace with real implementation. return atomic_boolean_; }; // Atomically exchange original value with a new one. Return previous value. - bool Set(bool value) override { - // TODO(b/184975123): replace with real implementation. - bool original = atomic_boolean_; - - atomic_boolean_ = value; - - return original; - }; + bool Set(bool value) override { return atomic_boolean_.exchange(value); }; private: std::atomic_bool atomic_boolean_; diff --git a/cpp/platform/impl/windows/atomic_reference.h b/cpp/platform/impl/windows/atomic_reference.h index 30b19b96..2879e6c1 100644 --- a/cpp/platform/impl/windows/atomic_reference.h +++ b/cpp/platform/impl/windows/atomic_reference.h @@ -26,15 +26,12 @@ namespace windows { // Type that allows 32-bit atomic reads and writes. class AtomicUint32 : public api::AtomicUint32 { public: - // TODO(b/184975123): replace with real implementation. ~AtomicUint32() override = default; // Atomically reads and returns stored value. - // TODO(b/184975123): replace with real implementation. std::uint32_t Get() const override { return atomic_uint32_; }; // Atomically stores value. - // TODO(b/184975123): replace with real implementation. void Set(std::uint32_t value) override { atomic_uint32_ = value; } private: