mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 07:36:10 -04:00
Merge branch 'master' into release
Change-Id: I56ea2217899e92bdd9d6cb56797ac9895e194fff
This commit is contained in:
@@ -15,22 +15,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