30 :
Thread {
"HighResolutionTimerThread" },
41 void startTimer (
int newIntervalMs)
71 int getIntervalMs()
const
73 return isThreadRunning() && timer !=
nullptr ? timer->getIntervalMs() : 0;
79 const auto copyTimer = [&]
87 if (
auto t = copyTimer())
98 : listener { l }, intervalMs { i } {}
100 int getIntervalMs()
const
112 #if JUCE_MAC || JUCE_IOS
116 const auto millisecondsUntil = [] (
auto time)
121 while (! stop.wait (millisecondsUntil (nextEventTime)))
125 listener.onTimerExpired();
126 nextEventTime += intervalMs;
133 const int intervalMs;
bool startThread()
Attempts to start a new thread with default ('Priority::normal') priority.
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.
bool isThreadRunning() const
Returns true if the thread is currently active.
static double getMillisecondCounterHiRes() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
Allows threads to wait for events triggered by other threads.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
A selection of options available when creating realtime threads.
RealtimeOptions withPeriodMs(double newPeriodMs) const
Specify the approximate amount of time between each thread wake up.