DSPatch v.10.2.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DSPatch::internal::ParallelCircuitThread Class Referencefinal

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

#include <ParallelCircuitThread.h>

Public Member Functions

 NONCOPYABLE (ParallelCircuitThread)
 
 ParallelCircuitThread (ParallelCircuitThread &&)
 
void Start (std::vector< DSPatch::Component * > *components, int bufferNo, int threadNo, int threadCount)
 
void Stop ()
 
void Sync ()
 
void Resume ()
 

Detailed Description

Thread class for asynchronously ticking parallel circuit components.

A ParallelCircuitThread is responsible for ticking parallel components within a Circuit. Upon initialisation, a reference to the parallel-ordered vector of circuit components must be provided for the thread _Run() method to loop through. Each ParallelCircuitThread has a buffer number (bufferNo) and thread number (threadNo), which is also provided upon initialisation. When creating multiple ParallelCircuitThreads, each thread must have their own unique bufferNo:threadNo combination, beginning at 0:0 and incrementing for every buffer thread added. The buffer number corresponds with the Component's buffer number when calling its Tick() method in the ParallelCircuitThread's component loop, and the thread number is that buffer's thread index - i.e. a circuit with x threads, will spawn x threads per buffer.

The Sync() method will block until the thread is ready to process. The Resume() method will then signal the ParallelCircuitThread to tick its 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 CircuitThread, therefore, from an external control loop (I.e. Circuit's Tick() method) we can simply loop through our array of ParallelCircuitThreads twice, calling Sync() on each, then Resume() on each.

Definition at line 65 of file ParallelCircuitThread.h.

Constructor & Destructor Documentation

◆ ParallelCircuitThread()

DSPatch::internal::ParallelCircuitThread::ParallelCircuitThread ( ParallelCircuitThread &&  )
inline

Definition at line 73 of file ParallelCircuitThread.h.

◆ ~ParallelCircuitThread()

DSPatch::internal::ParallelCircuitThread::~ParallelCircuitThread ( )
inline

Definition at line 77 of file ParallelCircuitThread.h.

Member Function Documentation

◆ Resume()

void DSPatch::internal::ParallelCircuitThread::Resume ( )
inline

Definition at line 117 of file ParallelCircuitThread.h.

◆ Start()

void DSPatch::internal::ParallelCircuitThread::Start ( std::vector< DSPatch::Component * > *  components,
int  bufferNo,
int  threadNo,
int  threadCount 
)
inline

Definition at line 82 of file ParallelCircuitThread.h.

◆ Stop()

void DSPatch::internal::ParallelCircuitThread::Stop ( )
inline

Definition at line 95 of file ParallelCircuitThread.h.

◆ Sync()

void DSPatch::internal::ParallelCircuitThread::Sync ( )
inline

Definition at line 107 of file ParallelCircuitThread.h.


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