DSPatch v.9.7.5
No Matches
Public Member Functions | List of all members
DSPatch::internal::CircuitThread Class Referencefinal

Thread class for asynchronously ticking circuit components. More...

#include <CircuitThread.h>

Public Member Functions

 NONCOPYABLE (CircuitThread)
 CircuitThread (CircuitThread &&)
void Start (std::vector< DSPatch::Component::SPtr > *components, int threadNo)
void Stop ()
void Sync ()
void SyncAndResume ()

Detailed Description

Thread class for asynchronously ticking circuit components.

A CircuitThread is responsible for ticking and reseting all components within a Circuit. Upon initialisation, a reference to the vector of circuit components must be provided for the thread _Run() method to loop through. Each CircuitThread has a thread number (threadNo), which is also provided upon initialisation. When creating multiple CircuitThreads, each thread must have their own unique thread number, beginning at 0 and incrementing by 1 for every thread added. This thread number corresponds with the Component's buffer number when calling its Tick() and Reset() methods in the CircuitThread's component loop. Hence, for every circuit thread created, each component's buffer count within that circuit must be incremented to match.

The SyncAndResume() method causes the CircuitThread to tick and reset all circuit components once, after which the thread will wait until instructed to resume again. As each component is done processing it hands over control to the next waiting circuit thread, therefore, from an external control loop (I.e. Circuit's Tick() method) we can simply loop through our array of CircuitThreads calling SyncAndResume() on each. If a circuit thread is busy processing, a call to SyncAndResume() will block momentarily until that thread is done processing.

Definition at line 66 of file CircuitThread.h.

Constructor & Destructor Documentation

◆ CircuitThread()

DSPatch::internal::CircuitThread::CircuitThread ( CircuitThread &&  )

Definition at line 74 of file CircuitThread.h.

◆ ~CircuitThread()

DSPatch::internal::CircuitThread::~CircuitThread ( )

Definition at line 78 of file CircuitThread.h.

Member Function Documentation

◆ Start()

void DSPatch::internal::CircuitThread::Start ( std::vector< DSPatch::Component::SPtr > *  components,
int  threadNo 

Definition at line 83 of file CircuitThread.h.

◆ Stop()

void DSPatch::internal::CircuitThread::Stop ( )

Definition at line 100 of file CircuitThread.h.

◆ Sync()

void DSPatch::internal::CircuitThread::Sync ( )

Definition at line 119 of file CircuitThread.h.

◆ SyncAndResume()

void DSPatch::internal::CircuitThread::SyncAndResume ( )

Definition at line 135 of file CircuitThread.h.

The documentation for this class was generated from the following file: