32 RealtimeProperty (T initial = T{}) : value_ (initial), pending_ (initial) { }
35 void setRT (
const T &newValue)
37 pending_.store (newValue, std::memory_order_release);
38 has_update_.store (
true, std::memory_order_release);
42 T getRT ()
const {
return pending_.load (std::memory_order_acquire); }
45 T get ()
const {
return value_; }
48 void set (
const T &newValue)
51 pending_.store (newValue, std::memory_order_release);
52 has_update_.store (
false, std::memory_order_release);
57 if (!has_update_.load (std::memory_order_acquire))
62 value_ = pending_.load (std::memory_order_acquire);
63 has_update_.store (
false, std::memory_order_release);
69 std::atomic<T> pending_;
70 std::atomic<bool> has_update_{
false };