| @@ -23,8 +23,7 @@ | |||||
| namespace juce | namespace juce | ||||
| { | { | ||||
| class Timer::TimerThread final : private Thread, | |||||
| private AsyncUpdater | |||||
| class Timer::TimerThread final : private Thread | |||||
| { | { | ||||
| public: | public: | ||||
| using LockType = CriticalSection; // (mysteriously, using a SpinLock here causes problems on some XP machines..) | using LockType = CriticalSection; // (mysteriously, using a SpinLock here causes problems on some XP machines..) | ||||
| @@ -32,12 +31,10 @@ public: | |||||
| TimerThread() : Thread ("JUCE Timer") | TimerThread() : Thread ("JUCE Timer") | ||||
| { | { | ||||
| timers.reserve (32); | timers.reserve (32); | ||||
| triggerAsyncUpdate(); | |||||
| } | } | ||||
| ~TimerThread() override | ~TimerThread() override | ||||
| { | { | ||||
| cancelPendingUpdate(); | |||||
| signalThreadShouldExit(); | signalThreadShouldExit(); | ||||
| callbackArrived.signal(); | callbackArrived.signal(); | ||||
| stopThread (-1); | stopThread (-1); | ||||
| @@ -121,14 +118,6 @@ public: | |||||
| void callTimersSynchronously() | void callTimersSynchronously() | ||||
| { | { | ||||
| if (! isThreadRunning()) | |||||
| { | |||||
| // (This is relied on by some plugins in cases where the MM has | |||||
| // had to restart and the async callback never started) | |||||
| cancelPendingUpdate(); | |||||
| triggerAsyncUpdate(); | |||||
| } | |||||
| callTimers(); | callTimers(); | ||||
| } | } | ||||
| @@ -136,6 +125,9 @@ public: | |||||
| { | { | ||||
| const LockType::ScopedLockType sl (lock); | const LockType::ScopedLockType sl (lock); | ||||
| if (! isThreadRunning()) | |||||
| startThread (Thread::Priority::high); | |||||
| // Trying to add a timer that's already here - shouldn't get to this point, | // Trying to add a timer that's already here - shouldn't get to this point, | ||||
| // so if you get this assertion, let me know! | // so if you get this assertion, let me know! | ||||
| jassert (std::none_of (timers.begin(), timers.end(), | jassert (std::none_of (timers.begin(), timers.end(), | ||||
| @@ -281,11 +273,6 @@ private: | |||||
| return timers.front().countdownMs; | return timers.front().countdownMs; | ||||
| } | } | ||||
| void handleAsyncUpdate() override | |||||
| { | |||||
| startThread (Priority::high); | |||||
| } | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TimerThread) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TimerThread) | ||||
| }; | }; | ||||