MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ begin_serialized_write()

void MayaFlux::Memory::Seqlock::begin_serialized_write ( )
inlinenoexcept

Claim the writer sequence after any active writer completes.

Spins while the sequence is odd, then atomically advances it to odd. Pair with end_write(), or use SerializedSeqlockWriteGuard. All writers using this path must hold the claim for their entire mutation.

Definition at line 71 of file SeqLock.hpp.

72 {
73 uint32_t expected = m_seq.load(std::memory_order_relaxed);
74 for (;;) {
75 if (!(expected & 1U)
76 && m_seq.compare_exchange_weak(expected, expected + 1U,
77 std::memory_order_acquire, std::memory_order_relaxed))
78 return;
79 expected = m_seq.load(std::memory_order_relaxed);
80 }
81 }
std::atomic< uint32_t > m_seq
Definition SeqLock.hpp:134

References m_seq.

Referenced by MayaFlux::Memory::SerializedSeqlockWriteGuard::SerializedSeqlockWriteGuard().

+ Here is the caller graph for this function: