Internal change

PiperOrigin-RevId: 380085191
This commit is contained in:
hai007
2021-06-17 17:57:17 -07:00
committed by Copybara-Service
parent 78f19e26be
commit 216a6d8ae0
2 changed files with 3 additions and 15 deletions
+3 -12
View File
@@ -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 <atomic>
#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_;
@@ -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: