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

◆ mark_buffer_processed()

bool MayaFlux::Nodes::Node::mark_buffer_processed ( )

Marks the node as having been processed by a buffer.

Returns
true if the buffer was successfully marked as processed

This method checks if the node can be marked as processed based on the current buffer count and node state. If conditions are met, it updates the processed flag and increments the reset counter.

Definition at line 154 of file Node.cpp.

155{
156 uint32_t count = m_buffer_count.load(std::memory_order_acquire);
157 auto state = m_state.load(std::memory_order_acquire);
158
159 if (count >= 1 && state == NodeState::INACTIVE) {
160 if (count == 1) {
161 return true;
162 }
163 bool expected = false;
164 if (m_buffer_processed.compare_exchange_strong(expected, true,
165 std::memory_order_acq_rel)) {
166 m_buffer_reset_count.fetch_add(1, std::memory_order_release);
167 return true;
168 }
169 }
170 return false;
171}
size_t count
std::atomic< bool > m_buffer_processed
Flag indicating whether the buffer has been processed This atomic flag is set when the buffer has bee...
Definition Node.hpp:788
std::atomic< NodeState > m_state
Atomic state flag tracking the node's processing status.
Definition Node.hpp:543
std::atomic< uint32_t > m_buffer_reset_count
Counter tracking how many buffers have requested a reset.
Definition Node.hpp:797
std::atomic< uint32_t > m_buffer_count
Counter tracking how many buffers are using this node This counter is incremented when a buffer start...
Definition Node.hpp:781
@ INACTIVE
Engine is not processing this node.
Definition NodeSpec.hpp:44

References count, MayaFlux::Nodes::INACTIVE, m_buffer_count, m_buffer_processed, m_buffer_reset_count, and m_state.