MayaFlux 0.5.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 148 of file Node.cpp.

149{
150 uint32_t count = m_buffer_count.load(std::memory_order_acquire);
151 auto state = m_state.load(std::memory_order_acquire);
152
153 if (count >= 1 && state == NodeState::INACTIVE) {
154 if (count == 1) {
155 return true;
156 }
157 bool expected = false;
158 if (m_buffer_processed.compare_exchange_strong(expected, true,
159 std::memory_order_acq_rel)) {
160 m_buffer_reset_count.fetch_add(1, std::memory_order_release);
161 return true;
162 }
163 }
164 return false;
165}
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:767
std::atomic< NodeState > m_state
Atomic state flag tracking the node's processing status.
Definition Node.hpp:522
std::atomic< uint32_t > m_buffer_reset_count
Counter tracking how many buffers have requested a reset.
Definition Node.hpp:776
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:760
@ 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.