mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
nearby: snapshot of cl/317978613
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I4bf367877a986910bb03e1c54aa972b4bcd59942
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
#ifndef PLATFORM_V2_API_ATOMIC_REFERENCE_H_
|
||||
#define PLATFORM_V2_API_ATOMIC_REFERENCE_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
|
||||
// An object reference that may be updated atomically.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html
|
||||
template <typename T>
|
||||
class AtomicReference {
|
||||
// Type that allows 32-bit atomic reads and writes.
|
||||
class AtomicUint32 {
|
||||
public:
|
||||
virtual ~AtomicReference() = default;
|
||||
virtual ~AtomicUint32() = default;
|
||||
|
||||
virtual T Get() const & = 0;
|
||||
virtual T Get() && = 0;
|
||||
virtual void Set(const T& value) = 0;
|
||||
virtual void Set(T&& value) = 0;
|
||||
// Atomically reads and returns stored value.
|
||||
virtual std::uint32_t Get() const = 0;
|
||||
|
||||
// Atomically stores value.
|
||||
virtual void Set(std::uint32_t value) = 0;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
Reference in New Issue
Block a user