fix high CPU usage under low framerate limit

This commit is contained in:
Eduardo Bart 2012-06-15 08:46:55 -03:00
parent cae4d46a7d
commit 10b60a3871
1 changed files with 2 additions and 2 deletions

View File

@ -244,9 +244,9 @@ void Application::run()
m_backgroundFrameCounter.update(); m_backgroundFrameCounter.update();
m_foregroundFrameCounter.update(); m_foregroundFrameCounter.update();
int sleepMicros = std::min(m_backgroundFrameCounter.getMaximumSleepMicros(), m_foregroundFrameCounter.getMaximumSleepMicros()); int sleepMicros = m_backgroundFrameCounter.getMaximumSleepMicros();
if(sleepMicros >= AdaptativeFrameCounter::MINIMUM_MICROS_SLEEP) if(sleepMicros >= AdaptativeFrameCounter::MINIMUM_MICROS_SLEEP)
stdext::microsleep(AdaptativeFrameCounter::MINIMUM_MICROS_SLEEP); stdext::microsleep(sleepMicros);
} else { } else {
// sleeps until next poll to avoid massive cpu usage // sleeps until next poll to avoid massive cpu usage