OpenShot Audio Library | OpenShotAudio: juce::TimeSliceThread Class Reference

OpenShot Audio Library | OpenShotAudio 0.4.0 |

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::TimeSliceThread Class Reference

`#include <juce_TimeSliceThread.h>`

Inheritance diagram for juce::TimeSliceThread:

## Public Member Functions
| TimeSliceThread (const String &threadName)
| ~TimeSliceThread () override
void | addTimeSliceClient (TimeSliceClient *clientToAdd, int millisecondsBeforeStarting=0)
void | moveToFrontOfQueue (TimeSliceClient *clientToMove)
void | removeTimeSliceClient (TimeSliceClient *clientToRemove)
void | removeAllClients ()
int | getNumClients () const
TimeSliceClient * | getClient (int index) const
bool | contains (const TimeSliceClient *) const
void | run () override
Public Member Functions inherited from juce::Thread
| Thread (const String &threadName, size_t threadStackSize=osDefaultStackSize)
virtual | ~Thread ()
bool | startThread ()
bool | startThread (Priority newPriority)
bool | startRealtimeThread (const RealtimeOptions &options)
bool | stopThread (int timeOutMilliseconds)
bool | isThreadRunning () const
void | signalThreadShouldExit ()
bool | threadShouldExit () const
bool | waitForThreadToExit (int timeOutMilliseconds) const
void | addListener (Listener *)
void | removeListener (Listener *)
bool | isRealtime () const
void | setAffinityMask (uint32 affinityMask)
bool | wait (double timeOutMilliseconds) const
void | notify () const
ThreadID | getThreadId () const noexcept
const String & | getThreadName () const noexcept

## Additional Inherited Members
Public Types inherited from juce::Thread
enum class | Priority { highest = 2 , high = 1 , normal = 0 , low = -1 , background = -2 }
using | ThreadID = void*
Static Public Member Functions inherited from juce::Thread
static bool | launch (std::function< void()> functionToRun)
static bool | launch (Priority priority, std::function< void()> functionToRun)
static bool | currentThreadShouldExit ()
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)
Static Public Attributes inherited from juce::Thread
static constexpr size_t | osDefaultStackSize { 0 }
Protected Member Functions inherited from juce::Thread
Priority | getPriority () const
bool | setPriority (Priority newPriority)

## 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

Definition at line 82 of file juce_TimeSliceThread.h.

## Constructor & Destructor Documentation

## ◆ TimeSliceThread()

juce::TimeSliceThread::TimeSliceThread | ( | const String & | threadName | ) |
| explicit

Creates a TimeSliceThread.

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

Definition at line 26 of file juce_TimeSliceThread.cpp.

## ◆ ~TimeSliceThread()

juce::TimeSliceThread::~TimeSliceThread | ( |  | ) |
| override

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).

Definition at line 30 of file juce_TimeSliceThread.cpp.

## Member Function Documentation

## ◆ addTimeSliceClient()

void juce::TimeSliceThread::addTimeSliceClient | ( | TimeSliceClient * | clientToAdd,
|  | 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).

Definition at line 36 of file juce_TimeSliceThread.cpp.

Referenced by juce::BufferingAudioReader::BufferingAudioReader().

## ◆ contains()

bool juce::TimeSliceThread::contains | ( | const TimeSliceClient * | c | ) | const

Returns true if the client is currently registered.

Definition at line 102 of file juce_TimeSliceThread.cpp.

## ◆ getClient()

TimeSliceClient * juce::TimeSliceThread::getClient | ( | int | index | ) | const

Returns one of the registered clients.

Definition at line 96 of file juce_TimeSliceThread.cpp.

Referenced by removeAllClients().

## ◆ getNumClients()

int juce::TimeSliceThread::getNumClients | ( |  | ) | const

Returns the number of registered clients.

Definition at line 90 of file juce_TimeSliceThread.cpp.

## ◆ moveToFrontOfQueue()

void juce::TimeSliceThread::moveToFrontOfQueue | ( | TimeSliceClient * | clientToMove | ) |

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.

Definition at line 79 of file juce_TimeSliceThread.cpp.

## ◆ removeAllClients()

void juce::TimeSliceThread::removeAllClients | ( |  | ) |

Removes all the active and pending clients from the list. This method will make sure that all callbacks to clients have finished before the method returns.

Definition at line 68 of file juce_TimeSliceThread.cpp.

## ◆ removeTimeSliceClient()

void juce::TimeSliceThread::removeTimeSliceClient | ( | TimeSliceClient * | clientToRemove | ) |

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

Definition at line 47 of file juce_TimeSliceThread.cpp.

Referenced by removeAllClients().

## ◆ run()

void juce::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.

Definition at line 128 of file juce_TimeSliceThread.cpp.

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

- juce_TimeSliceThread.h
- juce_TimeSliceThread.cpp