mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 15:16:12 -04:00
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I8936b527079074d5c3af5531b9245063767cc4a7
31 lines
777 B
C++
31 lines
777 B
C++
#ifndef PLATFORM_V2_IMPL_G3_ATOMIC_BOOLEAN_H_
|
|
#define PLATFORM_V2_IMPL_G3_ATOMIC_BOOLEAN_H_
|
|
|
|
#include <atomic>
|
|
|
|
#include "platform_v2/api/atomic_boolean.h"
|
|
|
|
namespace location {
|
|
namespace nearby {
|
|
namespace g3 {
|
|
|
|
// See documentation in
|
|
// https://source.corp.google.com/piper///depot/google3/platform_v2/api/atomic_boolean.h
|
|
class AtomicBoolean : public api::AtomicBoolean {
|
|
public:
|
|
explicit AtomicBoolean(bool initial_value) : value_(initial_value) {}
|
|
~AtomicBoolean() override = default;
|
|
|
|
bool Get() const override { return value_.load(); }
|
|
bool Set(bool value) override { return value_.exchange(value); }
|
|
|
|
private:
|
|
std::atomic_bool value_;
|
|
};
|
|
|
|
} // namespace g3
|
|
} // namespace nearby
|
|
} // namespace location
|
|
|
|
#endif // PLATFORM_V2_IMPL_G3_ATOMIC_BOOLEAN_H_
|