LMMS
Loading...
Searching...
No Matches
juce::dsp::BackgroundMessageQueue Class Reference
Inheritance diagram for juce::dsp::BackgroundMessageQueue:
juce::Thread juce::dsp::ConvolutionMessageQueue::Impl

Public Types

using IncomingCommand = FixedSizeFunction<400, void()>

Public Member Functions

 BackgroundMessageQueue (int entries)
bool push (IncomingCommand &command)
void popAll ()
void startThread ()
void startThread (int priority)
bool stopThread (int timeOutMilliseconds)

Private Member Functions

void run () override
Private Member Functions inherited from juce::Thread
 Thread (const String &threadName, size_t threadStackSize=0)
virtual ~Thread ()
void startThread ()
void startThread (int priority)
bool stopThread (int timeOutMilliseconds)
bool isThreadRunning () const
void signalThreadShouldExit ()
bool threadShouldExit () const
bool waitForThreadToExit (int timeOutMilliseconds) const
void addListener (Listener *)
void removeListener (Listener *)
bool setPriority (int priority)
void setAffinityMask (uint32 affinityMask)
bool wait (int timeOutMilliseconds) const
void notify () const
ThreadID getThreadId () const noexcept
const StringgetThreadName () const noexcept

Private Attributes

CriticalSection popMutex
Queue< IncomingCommandqueue

Additional Inherited Members

Private Types inherited from juce::Thread
enum  { realtimeAudioPriority = -1 }
using ThreadID = void*
Static Private Member Functions inherited from juce::Thread
static void launch (std::function< void()> functionToRun)
static bool currentThreadShouldExit ()
static bool setCurrentThreadPriority (int priority)
static void JUCE_CALLTYPE setCurrentThreadAffinityMask (uint32 affinityMask)
static void JUCE_CALLTYPE sleep (int milliseconds)
static void JUCE_CALLTYPE yield ()
static ThreadID JUCE_CALLTYPE getCurrentThreadId ()
static Thread *JUCE_CALLTYPE getCurrentThread ()
static void JUCE_CALLTYPE setCurrentThreadName (const String &newThreadName)

Member Typedef Documentation

◆ IncomingCommand

using juce::dsp::BackgroundMessageQueue::IncomingCommand = FixedSizeFunction<400, void()>

Constructor & Destructor Documentation

◆ BackgroundMessageQueue()

juce::dsp::BackgroundMessageQueue::BackgroundMessageQueue ( int entries)
inlineexplicit

Member Function Documentation

◆ popAll()

void juce::dsp::BackgroundMessageQueue::popAll ( )
inline

◆ push()

bool juce::dsp::BackgroundMessageQueue::push ( IncomingCommand & command)
inline

◆ run()

void juce::dsp::BackgroundMessageQueue::run ( )
inlineoverrideprivatevirtual

Must be implemented to perform the thread's actual code.

Remember that the thread must regularly check the threadShouldExit() method whilst running, and if this returns true it should return from the run() method as soon as possible to avoid being forcibly killed.

See also
threadShouldExit, startThread

Implements juce::Thread.

◆ startThread() [1/2]

void juce::Thread::startThread ( )

Starts the thread running.

This will cause the thread's run() method to be called by a new thread. If this thread is already running, startThread() won't do anything.

See also
stopThread

◆ startThread() [2/2]

void juce::Thread::startThread ( int priority)

Starts the thread with a given priority.

Launches the thread with a given priority, where 0 = lowest, 10 = highest. If the thread is already running, its priority will be changed.

See also
startThread, setPriority, realtimeAudioPriority

◆ stopThread()

bool juce::Thread::stopThread ( int timeOutMilliseconds)

Attempts to stop the thread running.

This method will cause the threadShouldExit() method to return true and call notify() in case the thread is currently waiting.

Hopefully the thread will then respond to this by exiting cleanly, and the stopThread method will wait for a given time-period for this to happen.

If the thread is stuck and fails to respond after the timeout, it gets forcibly killed, which is a very bad thing to happen, as it could still be holding locks, etc. which are needed by other parts of your program.

Parameters
timeOutMillisecondsThe number of milliseconds to wait for the thread to finish before killing it by force. A negative value in here will wait forever.
Returns
true if the thread was cleanly stopped before the timeout, or false if it had to be killed by force.
See also
signalThreadShouldExit, threadShouldExit, waitForThreadToExit, isThreadRunning

Member Data Documentation

◆ popMutex

CriticalSection juce::dsp::BackgroundMessageQueue::popMutex
private

◆ queue

Queue<IncomingCommand> juce::dsp::BackgroundMessageQueue::queue
private

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