|
|
|
@@ -295,20 +295,12 @@ Timer::TimerThread* Timer::TimerThread::instance = nullptr; |
|
|
|
Timer::TimerThread::LockType Timer::TimerThread::lock;
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
static SortedSet <Timer*> activeTimers;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Timer::Timer() noexcept
|
|
|
|
: countdownMs (0),
|
|
|
|
periodMs (0),
|
|
|
|
previous (nullptr),
|
|
|
|
next (nullptr)
|
|
|
|
{
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
|
|
|
|
activeTimers.add (this);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer::Timer (const Timer&) noexcept
|
|
|
|
@@ -317,30 +309,17 @@ Timer::Timer (const Timer&) noexcept |
|
|
|
previous (nullptr),
|
|
|
|
next (nullptr)
|
|
|
|
{
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
|
|
|
|
activeTimers.add (this);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer::~Timer()
|
|
|
|
{
|
|
|
|
stopTimer();
|
|
|
|
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
activeTimers.removeValue (this);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void Timer::startTimer (const int interval) noexcept
|
|
|
|
{
|
|
|
|
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
|
|
|
|
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
// this isn't a valid object! Your timer might be a dangling pointer or something..
|
|
|
|
jassert (activeTimers.contains (this));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (periodMs == 0)
|
|
|
|
{
|
|
|
|
countdownMs = interval;
|
|
|
|
@@ -357,11 +336,6 @@ void Timer::stopTimer() noexcept |
|
|
|
{
|
|
|
|
const TimerThread::LockType::ScopedLockType sl (TimerThread::lock);
|
|
|
|
|
|
|
|
#if JUCE_DEBUG
|
|
|
|
// this isn't a valid object! Your timer might be a dangling pointer or something..
|
|
|
|
jassert (activeTimers.contains (this));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (periodMs > 0)
|
|
|
|
{
|
|
|
|
TimerThread::remove (this);
|
|
|
|
|