DSPatch  v.2.42
C++ Cross-Platform, Object-Oriented, Flow-Based Programming Library
 All Classes Pages
Public Member Functions
DspCircuitThread Class Reference

Thread class for ticking and reseting circuit components. More...

#include <DspCircuitThread.h>

Inheritance diagram for DspCircuitThread:
DspThread

List of all members.

Public Member Functions

void Initialise (std::vector< DspComponent * > *components, unsigned short threadNo)
void Start (Priority priority=TimeCriticalPriority)
void Stop ()
void Sync ()
void Resume ()

Additional Inherited Members

- Public Types inherited from DspThread
enum  Priority {
  IdlePriority, LowestPriority, LowPriority, NormalPriority,
  HighPriority, HighestPriority, TimeCriticalPriority
}
- Static Public Member Functions inherited from DspThread
static void SetPriority (Priority priority)
static void MsSleep (unsigned short milliseconds)

Detailed Description

Thread class for ticking and reseting circuit components.

A DspCircuitThread is responsible for ticking and reseting all components in a DspCircuit. On construction, a reference to the vector of circuit components must be provided for the thread _Run() method to loop through. Each DspCircuitThread has a thread number (threadNo), which also can be provided on construction. When creating multiple DspCircuitThreads, 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 DspComponent's buffer number when calling it's ThreadTick() and ThreadReset() methods in the DspCircuitThread's component loop. Hence, for every circuit thread created, each component's buffer count within that circuit must be incremented to match.

The Resume() method causes the DspCircuitThread 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. DspCircuit's Process_() method) we simply loop through our array of DspCircuitThreads calling Resume() on each. If a circuit thread is busy processing, a call to Resume() will block momentarily until processing is complete, then begin the next iteration immediately upon unblocking the calling thread.

The Sync() method, when called, will block the calling thread until the circuit thread is done processing. If the circuit thread is already awaiting the next Resume() request, this method will return immediately.

Definition at line 62 of file DspCircuitThread.h.


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