openshot-audio  0.1.7
Public Member Functions | List of all members
juce::TimeSliceThread Class Reference

#include <juce_core.h>

Inheritance diagram for juce::TimeSliceThread:
juce::Thread

Public Member Functions

 TimeSliceThread (const String &threadName)
 
 ~TimeSliceThread ()
 
void addTimeSliceClient (TimeSliceClient *client, int millisecondsBeforeStarting=0)
 
void removeTimeSliceClient (TimeSliceClient *client)
 
void moveToFrontOfQueue (TimeSliceClient *client)
 
int getNumClients () const
 
TimeSliceClientgetClient (int index) const
 
void run () override
 
- Public Member Functions inherited from juce::Thread
 Thread (const String &threadName)
 
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
 
bool setPriority (int priority)
 
void setAffinityMask (uint32 affinityMask)
 
bool wait (int timeOutMilliseconds) const
 
void notify () const
 
ThreadID getThreadId () const noexcept
 
const StringgetThreadName () const
 

Additional Inherited Members

- Public Types inherited from juce::Thread
typedef void * ThreadID
 
- Static Public Member Functions inherited from juce::Thread
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)
 

Detailed Description

A thread that keeps a list of clients, and calls each one in turn, giving them all a chance to run some sort of short task.

See also
TimeSliceClient, Thread

Constructor & Destructor Documentation

◆ TimeSliceThread()

TimeSliceThread::TimeSliceThread ( const String threadName)
explicit

Creates a TimeSliceThread.

When first created, the thread is not running. Use the startThread() method to start it.

◆ ~TimeSliceThread()

TimeSliceThread::~TimeSliceThread ( )

Destructor.

Deleting a Thread object that is running will only give the thread a brief opportunity to stop itself cleanly, so it's recommended that you should always call stopThread() with a decent timeout before deleting, to avoid the thread being forcibly killed (which is a Bad Thing).

Member Function Documentation

◆ addTimeSliceClient()

void TimeSliceThread::addTimeSliceClient ( TimeSliceClient client,
int  millisecondsBeforeStarting = 0 
)

Adds a client to the list.

The client's callbacks will start after the number of milliseconds specified by millisecondsBeforeStarting (and this may happen before this method has returned).

◆ getClient()

TimeSliceClient * TimeSliceThread::getClient ( int  index) const

Returns one of the registered clients.

◆ getNumClients()

int TimeSliceThread::getNumClients ( ) const

Returns the number of registered clients.

◆ moveToFrontOfQueue()

void TimeSliceThread::moveToFrontOfQueue ( TimeSliceClient client)

If the given client is waiting in the queue, it will be moved to the front and given a time-slice as soon as possible. If the specified client has not been added, nothing will happen.

◆ removeTimeSliceClient()

void TimeSliceThread::removeTimeSliceClient ( TimeSliceClient client)

Removes a client from the list.

This method will make sure that all callbacks to the client have completely finished before the method returns.

◆ run()

void TimeSliceThread::run ( )
overridevirtual

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.


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