JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
TimeSliceThread Class Reference

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

Inherits Thread.

Inherited by AudioThumbnailCache.

List of all members.

Public Member Functions

 TimeSliceThread (const String &threadName)
 Creates a TimeSliceThread.
 ~TimeSliceThread ()
 Destructor.
void addTimeSliceClient (TimeSliceClient *client, int millisecondsBeforeStarting=0)
 Adds a client to the list.
void removeTimeSliceClient (TimeSliceClient *client)
 Removes a client from the list.
void 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.
int getNumClients () const
 Returns the number of registered clients.
TimeSliceClientgetClient (int index) const
 Returns one of the registered clients.

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 ( const String threadName) [explicit]

Creates a TimeSliceThread.

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

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

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

Removes a client from the list.

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

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.

Returns the number of registered clients.

Returns one of the registered clients.


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