1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

TimeSliceThread: Add function to check whether a certain job is still registered

This commit is contained in:
reuk 2022-09-11 19:02:03 +01:00
parent 7aa3bfdc93
commit b70b7a309d
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 10 additions and 0 deletions

View file

@ -89,6 +89,7 @@ void TimeSliceThread::moveToFrontOfQueue (TimeSliceClient* client)
int TimeSliceThread::getNumClients() const
{
const ScopedLock sl (listLock);
return clients.size();
}
@ -98,6 +99,12 @@ TimeSliceClient* TimeSliceThread::getClient (const int i) const
return clients[i];
}
bool TimeSliceThread::contains (const TimeSliceClient* c) const
{
const ScopedLock sl (listLock);
return std::any_of (clients.begin(), clients.end(), [=] (auto* registered) { return registered == c; });
}
//==============================================================================
TimeSliceClient* TimeSliceThread::getNextClient (int index) const
{

View file

@ -131,6 +131,9 @@ public:
/** Returns one of the registered clients. */
TimeSliceClient* getClient (int index) const;
/** Returns true if the client is currently registered. */
bool contains (const TimeSliceClient*) const;
//==============================================================================
#ifndef DOXYGEN
void run() override;