38 if (client !=
nullptr)
42 clients.addIfNotAlreadyThere (client);
53 if (clientBeingCalled == client)
60 clients.removeFirstMatchingValue (client);
64 clients.removeFirstMatchingValue (client);
83 if (clients.contains (client))
93 return clients.size();
105 return std::any_of (clients.begin(), clients.end(), [=] (
auto*
registered) { return registered == c; });
114 for (
int i = clients.size(); --i >= 0;)
116 auto* c = clients.getUnchecked ((i + index) % clients.size());
118 if (c !=
nullptr && (client ==
nullptr || c->nextCallTime <
soonest))
166 clientBeingCalled = getNextClient (index);
169 if (clientBeingCalled !=
nullptr)
178 clients.removeFirstMatchingValue (clientBeingCalled);
180 clientBeingCalled =
nullptr;
Automatically locks and unlocks a mutex object.
Automatically unlocks and re-locks a mutex object.
static RelativeTime milliseconds(int milliseconds) noexcept
Creates a new RelativeTime object representing a number of milliseconds.
bool wait(double timeOutMilliseconds) const
Suspends the execution of this thread until either the specified timeout period has elapsed,...
virtual void run()=0
Must be implemented to perform the thread's actual code.
bool threadShouldExit() const
Checks whether the thread has been told to stop running.
bool stopThread(int timeOutMilliseconds)
Attempts to stop the thread running.
void notify() const
Wakes up the thread.
Used by the TimeSliceThread class.
virtual int useTimeSlice()=0
Called back by a TimeSliceThread.
int getNumClients() const
Returns the number of registered clients.
void removeTimeSliceClient(TimeSliceClient *clientToRemove)
Removes a client from the list.
void addTimeSliceClient(TimeSliceClient *clientToAdd, int millisecondsBeforeStarting=0)
Adds a client to the list.
~TimeSliceThread() override
Destructor.
TimeSliceClient * getClient(int index) const
Returns one of the registered clients.
void 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 ...
bool contains(const TimeSliceClient *) const
Returns true if the client is currently registered.
void removeAllClients()
Removes all the active and pending clients from the list.
TimeSliceThread(const String &threadName)
Creates a TimeSliceThread.
Holds an absolute date and time.
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Returns a Time object that is set to the current system time.
CriticalSection::ScopedLockType ScopedLock
Automatically locks and unlocks a CriticalSection object.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
long long int64
A platform-independent 64-bit integer type.