mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Tweak to runDispatchLoopUntil timekeeping.
This commit is contained in:
parent
c7506df13f
commit
67341e7c4d
1 changed files with 5 additions and 10 deletions
|
|
@ -94,8 +94,6 @@ void MessageManager::MessageBase::post()
|
|||
#if JUCE_MODAL_LOOPS_PERMITTED && ! (JUCE_MAC || JUCE_IOS)
|
||||
void MessageManager::runDispatchLoop()
|
||||
{
|
||||
jassert (isThisTheMessageThread()); // must only be called by the message thread
|
||||
|
||||
runDispatchLoopUntil (-1);
|
||||
}
|
||||
|
||||
|
|
@ -111,20 +109,17 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor)
|
|||
|
||||
const int64 endTime = Time::currentTimeMillis() + millisecondsToRunFor;
|
||||
|
||||
while ((millisecondsToRunFor < 0 || endTime > Time::currentTimeMillis())
|
||||
&& ! quitMessageReceived)
|
||||
while (! quitMessageReceived)
|
||||
{
|
||||
JUCE_TRY
|
||||
{
|
||||
if (! dispatchNextMessageOnSystemQueue (millisecondsToRunFor >= 0))
|
||||
{
|
||||
const int msToWait = (int) (endTime - Time::currentTimeMillis());
|
||||
|
||||
if (msToWait > 0)
|
||||
Thread::sleep (jmin (5, msToWait));
|
||||
}
|
||||
Thread::sleep (1);
|
||||
}
|
||||
JUCE_CATCH_EXCEPTION
|
||||
|
||||
if (millisecondsToRunFor >= 0 && Time::currentTimeMillis() >= currentTime)
|
||||
break;
|
||||
}
|
||||
|
||||
return ! quitMessageReceived;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue