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

◆ request_reset_from_channel()

void MayaFlux::Nodes::Node::request_reset_from_channel ( uint32_t  channel_id)

Requests a reset of the processed state from a specific channel.

Parameters
channel_idThe ID of the channel requesting the reset

This method is called by channels to signal that they have completed their processing and that the node's processed state should be reset. It uses a bitmask to track pending resets and ensures that all channels have completed before actually resetting the node's state.

Definition at line 61 of file Node.cpp.

62{
63 if (channel_id >= 32)
64 return;
65 auto channel_bit = static_cast<uint32_t>((0x0ffffffff) & (1ULL << (uint64_t)channel_id));
66 uint32_t old_pending = m_pending_reset_mask.fetch_or(channel_bit, std::memory_order_acq_rel);
67 uint32_t new_pending = old_pending | channel_bit;
68 uint32_t active_channels = m_active_channels_mask.load(std::memory_order_acquire);
69
70 if ((new_pending & active_channels) == active_channels && active_channels != 0) {
71 uint32_t expected = new_pending;
72 if (m_pending_reset_mask.compare_exchange_strong(expected, 0, std::memory_order_acq_rel)) {
74 }
75 }
76}
std::atomic< uint32_t > m_active_channels_mask
Bitmask tracking which channels are currently using this node.
Definition Node.hpp:483
std::atomic< uint32_t > m_pending_reset_mask
Bitmask tracking which channels have requested a reset.
Definition Node.hpp:492
virtual void reset_processed_state_internal()
Resets the processed state of the node directly.
Definition Node.cpp:91

References m_active_channels_mask, m_pending_reset_mask, and reset_processed_state_internal().

+ Here is the call graph for this function: