tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool Struct Referenceabstract

Base class for thread pools which can be customised to determine how cooperative threads should behave. More...

#include "tracktion_LockFreeMultiThreadedNodePlayer.h"

Inheritance diagram for tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool:
tracktion::graph::ThreadPoolCV tracktion::graph::ThreadPoolHybrid tracktion::graph::ThreadPoolRT tracktion::graph::ThreadPoolSem< SemaphoreType > tracktion::graph::ThreadPoolSemHybrid< SemaphoreType >

Public Member Functions

 ThreadPool (LockFreeMultiThreadedNodePlayer &p)
 Constructs a ThreadPool for a given LockFreeMultiThreadedNodePlayer.
 
virtual ~ThreadPool ()=default
 Destructor.
 
virtual void createThreads (size_t numThreads, juce::AudioWorkgroup)=0
 Subclasses should implement this to create the given number of threads.
 
virtual void clearThreads ()=0
 Subclasses should implement this to clear all the threads.
 
virtual void signalOne ()=0
 Called by the player when a Node becomes available to process.
 
virtual void signal (int numToSignal)=0
 Called by the player when more than one Node becomes available to process.
 
virtual void signalAll ()=0
 Called by the player when more than one Node becomes available to process.
 
virtual void waitForFinalNode ()=0
 Called by the player when the audio thread has no free Nodes to process.
 
void signalShouldExit ()
 Signals the pool that all the threads should exit.
 
void resetExitSignal ()
 Signals the pool that all the threads should continue to run and not exit.
 
bool shouldExit () const
 Returns true if all the threads should exit.
 
bool shouldWait ()
 Returns true if there are no free Nodes to be processed and the calling thread should wait until there are Nodes ready.
 
bool isFinalNodeReady ()
 Returns true if all the Nodes have been processed.
 
bool process ()
 Process the next chain of Nodes.
 
void setCurrentNode (LockFreeMultiThreadedNodePlayer::PreparedNode *nodeInUse)
 Sets the current PreparedNode in use.
 

Public Attributes

LockFreeMultiThreadedNodePlayerplayer
 

Detailed Description

Base class for thread pools which can be customised to determine how cooperative threads should behave.

Definition at line 83 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

Constructor & Destructor Documentation

◆ ThreadPool()

tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::ThreadPool ( LockFreeMultiThreadedNodePlayer p)

Constructs a ThreadPool for a given LockFreeMultiThreadedNodePlayer.

Definition at line 86 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

Member Function Documentation

◆ clearThreads()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::clearThreads ( )
pure virtual

◆ createThreads()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::createThreads ( size_t  numThreads,
juce::AudioWorkgroup   
)
pure virtual

◆ isFinalNodeReady()

bool tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::isFinalNodeReady ( )

Returns true if all the Nodes have been processed.

Definition at line 153 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ process()

bool tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::process ( )

Process the next chain of Nodes.

Returns true if at least one Node was processed, false if no Nodes were processed. You can use this to determine how long to pause/wait for before processing again.

Definition at line 167 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ resetExitSignal()

void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::resetExitSignal ( )

Signals the pool that all the threads should continue to run and not exit.

Definition at line 130 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ setCurrentNode()

void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::setCurrentNode ( LockFreeMultiThreadedNodePlayer::PreparedNode *  nodeInUse)

Sets the current PreparedNode in use.

This should live as long as the threads are running once set.

Definition at line 176 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ shouldExit()

bool tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::shouldExit ( ) const

Returns true if all the threads should exit.

Definition at line 136 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ shouldWait()

bool tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::shouldWait ( )

Returns true if there are no free Nodes to be processed and the calling thread should wait until there are Nodes ready.

Definition at line 144 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ signal()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::signal ( int  numToSignal)
pure virtual

Called by the player when more than one Node becomes available to process.

Subclasses should use this to try and get a thread to call process as soon as possible.

Implemented in tracktion::graph::ThreadPoolCV, tracktion::graph::ThreadPoolHybrid, tracktion::graph::ThreadPoolSem< SemaphoreType >, tracktion::graph::ThreadPoolSemHybrid< SemaphoreType >, and tracktion::graph::ThreadPoolRT.

◆ signalAll()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::signalAll ( )
pure virtual

Called by the player when more than one Node becomes available to process.

Subclasses should use this to try and get a thread to call process as soon as possible.

Implemented in tracktion::graph::ThreadPoolCV, tracktion::graph::ThreadPoolRT, tracktion::graph::ThreadPoolHybrid, tracktion::graph::ThreadPoolSem< SemaphoreType >, and tracktion::graph::ThreadPoolSemHybrid< SemaphoreType >.

◆ signalOne()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::signalOne ( )
pure virtual

Called by the player when a Node becomes available to process.

Subclasses should use this to try and get a thread to call process as soon as possible.

Implemented in tracktion::graph::ThreadPoolCV, tracktion::graph::ThreadPoolRT, tracktion::graph::ThreadPoolHybrid, tracktion::graph::ThreadPoolSem< SemaphoreType >, and tracktion::graph::ThreadPoolSemHybrid< SemaphoreType >.

◆ signalShouldExit()

void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::signalShouldExit ( )

Signals the pool that all the threads should exit.

Definition at line 123 of file tracktion_LockFreeMultiThreadedNodePlayer.h.

◆ waitForFinalNode()

virtual void tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::waitForFinalNode ( )
pure virtual

Called by the player when the audio thread has no free Nodes to process.

Subclasses should can use this to either spin, pause or wait until a Node does become free or isFinalNodeReady returns true.

Implemented in tracktion::graph::ThreadPoolCV, tracktion::graph::ThreadPoolRT, tracktion::graph::ThreadPoolHybrid, tracktion::graph::ThreadPoolSem< SemaphoreType >, and tracktion::graph::ThreadPoolSemHybrid< SemaphoreType >.

Member Data Documentation

◆ player

LockFreeMultiThreadedNodePlayer& tracktion::graph::LockFreeMultiThreadedNodePlayer::ThreadPool::player

Definition at line 184 of file tracktion_LockFreeMultiThreadedNodePlayer.h.


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