fix high CPU usage under low framerate limit

master
Eduardo Bart 12 years ago
parent cae4d46a7d
commit 10b60a3871

@ -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

Loading…
Cancel
Save