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

◆ read()

template<typename T>
Guard MayaFlux::Memory::SnapshotCell< T >::read ( ) const
inlinenodiscardnoexcept

Pins the current snapshot.

Returns
A Guard over it, empty when the cell holds nothing.

Definition at line 130 of file SnapshotCell.hpp.

131 {
132 m_readers.fetch_add(1);
133 const T* value = m_head.load();
134 if (!value) {
135 m_readers.fetch_sub(1);
136 return {};
137 }
138 return Guard(this, value);
139 }
Keeps one snapshot alive and unchanged while it exists.
std::atomic< uint32_t > m_readers
std::atomic< const T * > m_head
Lock-free cell holding one immutable snapshot of a value, read without blocking.

References m_head, and m_readers.

Referenced by MayaFlux::ControlSnapshot< T >::assign(), MayaFlux::ControlSnapshot< T >::copy_state(), MayaFlux::Platform::SystemConfig::get_dep_includes(), MayaFlux::Platform::detail::memoize_nonempty(), MayaFlux::Core::BackendWindowHandler::start_readback_thread(), and update().

Here is the caller graph for this function: