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

Added a safety mechanism for pathological cases where user code that repeatedly blocks in a timer callback could get the event loop stuck

This commit is contained in:
jules 2016-02-12 11:36:34 +00:00
parent b010df5bcd
commit 15d746cf6e

View file

@ -92,6 +92,9 @@ public:
void callTimers()
{
// avoid getting stuck in a loop if a timer callback repeatedly takes too long
const uint32 timeout = Time::getMillisecondCounter() + 100;
const LockType::ScopedLockType sl (lock);
while (firstTimer != nullptr && firstTimer->timerCountdownMs <= 0)
@ -109,6 +112,9 @@ public:
t->timerCallback();
}
JUCE_CATCH_EXCEPTION
if (Time::getMillisecondCounter() > timeout)
break;
}
callbackArrived.signal();