mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I9850950db8bd84f0904ea1a413151887f52098cf
31 lines
762 B
C++
31 lines
762 B
C++
#ifndef PLATFORM_IMPL_G3_ATOMIC_BOOLEAN_H_
|
|
#define PLATFORM_IMPL_G3_ATOMIC_BOOLEAN_H_
|
|
|
|
#include <atomic>
|
|
|
|
#include "platform/api/atomic_boolean.h"
|
|
|
|
namespace location {
|
|
namespace nearby {
|
|
namespace g3 {
|
|
|
|
// See documentation in
|
|
// https://source.corp.google.com/piper///depot/google3/platform/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_IMPL_G3_ATOMIC_BOOLEAN_H_
|