Contents

class

SushiDSP::RtGraphSlot

Publishes RigGraph replacements to the audio thread without locking or blocking it, and frees a retired graph only once the audio thread has moved past it.

Declared in
include/SushiDSP/core/RtGraphSlot.hpp

publish() and reclaim() belong to one non-RT thread and acquire_for_audio_thread() to one audio thread; the slot synchronises neither side against itself (include/SushiDSP/README.md).

Public member functions

RtGraphSlot()=default
~RtGraphSlot()
RtGraphSlot(const RtGraphSlot &)=delete
RtGraphSlot & operator=(const RtGraphSlot &)=delete
void publish(std::unique_ptr< RigGraph > new_graph)

Makes new_graph the active graph for subsequent acquire_for_audio_thread() calls.

Not real-time safe; call only off the audio thread. Must be called from a single, consistent non-RT thread (or externally synchronized if called from more than one) - see the class-level threading contract.

Parameters

new_graph

The fully compiled graph to publish. Must not be null.

RigGraph * acquire_for_audio_thread() noexcept

Returns the current active graph and records that this generation is now in use.

Real-time safe: one atomic load, one atomic store, no allocation. Must be called from a single, consistent audio thread - see the class-level threading contract.

Returns

The active graph, or nullptr if publish() was never called. The returned pointer is valid only until this same thread's NEXT call to acquire_for_audio_thread(); do not retain it across calls.

void reclaim()

Frees every retired graph the audio thread has moved past.

Not real-time safe; call periodically off the audio thread (e.g. once per GUI frame). Must be called from the same single, consistent non-RT thread as publish() (or externally synchronized if called from more than one) - see the class-level threading contract.