52 template <
typename... Args>
60 template <
typename Op>
62 const auto old =
m_seq.load(std::memory_order_relaxed);
65 ut_ad((old & 1) == 0);
66 m_seq.store(old + 1, std::memory_order_relaxed);
71 std::atomic_thread_fence(std::memory_order_release);
73 m_seq.store(old + 2, std::memory_order_release);
79 template <
typename Op>
83 const auto seq_before =
m_seq.load(std::memory_order_acquire);
84 if ((seq_before & 1) == 1) {
87 if ((++try_count & 7) == 0) {
88 std::this_thread::yield();
93 std::atomic_thread_fence(std::memory_order_acquire);
94 const auto seq_after =
m_seq.load(std::memory_order_relaxed);
95 if (seq_before == seq_after) {
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:40
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:48
void write(Op &&op)
Writes a new value for the variable of type T.
Definition: ut0seq_lock.h:61
std::atomic< uint64_t > m_seq
Sequence count.
Definition: ut0seq_lock.h:128
T m_value
Stored value.
Definition: ut0seq_lock.h:125
auto read(Op &&op) const
Definition: ut0seq_lock.h:80
Seq_lock(Args... args)
Definition: ut0seq_lock.h:53
Definition: varlen_sort.h:174
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:47
Utilities related to class lifecycle.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:104