JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::TimeSliceClient Class Referenceabstract

Used by the TimeSliceThread class. More...

#include <juce_TimeSliceThread.h>

Inheritance diagram for juce::TimeSliceClient:
Collaboration diagram for juce::TimeSliceClient:

Public Member Functions

virtual ~TimeSliceClient ()=default
 Destructor. More...
 
virtual int useTimeSlice ()=0
 Called back by a TimeSliceThread. More...
 

Private Attributes

Time nextCallTime
 

Friends

class TimeSliceThread
 

Detailed Description

Used by the TimeSliceThread class.

To register your class with a TimeSliceThread, derive from this class and use the TimeSliceThread::addTimeSliceClient() method to add it to the list.

Make sure you always call TimeSliceThread::removeTimeSliceClient() before deleting your client!

See also
TimeSliceThread

@tags{Core}

Constructor & Destructor Documentation

◆ ~TimeSliceClient()

virtual juce::TimeSliceClient::~TimeSliceClient ( )
virtualdefault

Destructor.

Member Function Documentation

◆ useTimeSlice()

virtual int juce::TimeSliceClient::useTimeSlice ( )
pure virtual

Called back by a TimeSliceThread.

When you register this class with it, a TimeSliceThread will repeatedly call this method.

The implementation of this method should use its time-slice to do something that's quick - never block for longer than absolutely necessary.

Returns
Your method should return the number of milliseconds which it would like to wait before being called again. Returning 0 will make the thread call again as soon as possible (after possibly servicing other busy clients). If you return a value below zero, your client will be removed from the list of clients, and won't be called again. The value you specify isn't a guarantee, and is only used as a hint by the thread - the actual time before the next callback may be more or less than specified. You can force the TimeSliceThread to wake up and poll again immediately by calling its notify() method.

Implemented in juce::DirectoryContentsList, juce::BufferingAudioSource, and juce::BufferingAudioReader.

Friends And Related Function Documentation

◆ TimeSliceThread

friend class TimeSliceThread
friend

Member Data Documentation

◆ nextCallTime

Time juce::TimeSliceClient::nextCallTime
private

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