53 template <
typename... Args>
61 template <
typename Op>
63 const auto old =
m_seq.load(std::memory_order_relaxed);
66 ut_ad((old & 1) == 0);
67 m_seq.store(old + 1, std::memory_order_relaxed);
72 std::atomic_thread_fence(std::memory_order_release);
74 m_seq.store(old + 2, std::memory_order_release);
80 template <
typename Op>
84 const auto seq_before =
m_seq.load(std::memory_order_acquire);
85 if ((seq_before & 1) == 1) {
88 if ((++try_count & 7) == 0) {
89 std::this_thread::yield();
94 std::atomic_thread_fence(std::memory_order_acquire);
95 const auto seq_after =
m_seq.load(std::memory_order_relaxed);
96 if (seq_before == seq_after) {
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:41
A class that allows to read value of variable of some type T atomically and allows the value to be ch...
Definition: ut0seq_lock.h:49
void write(Op &&op)
Writes a new value for the variable of type T.
Definition: ut0seq_lock.h:62
std::atomic< uint64_t > m_seq
Sequence count.
Definition: ut0seq_lock.h:129
T m_value
Stored value.
Definition: ut0seq_lock.h:126
auto read(Op &&op) const
Definition: ut0seq_lock.h:81
Seq_lock(Args... args)
Definition: ut0seq_lock.h:54
Definition: gcs_xcom_synode.h:64
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
Utilities related to class lifecycle.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:69