mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-02 23:49:40 +00:00
TOON: Ensure minimum delay in worst case of render() loop to allow thread scheduling.
This should ensure that CPU usage is not pegged at 100%. svn-id: r55790
This commit is contained in:
parent
e990453a4d
commit
36b6d961c2
@ -419,13 +419,13 @@ void ToonEngine::render() {
|
||||
copyToVirtualScreen(true);
|
||||
}
|
||||
|
||||
// add a little sleep here if needed.
|
||||
// add a little sleep here
|
||||
int32 newMillis = (int32)_system->getMillis();
|
||||
if (newMillis - _lastRenderTime < _tickLength) {
|
||||
int32 sleepMs = _tickLength - (newMillis - _lastRenderTime);
|
||||
assert(sleepMs >= 0);
|
||||
_system->delayMillis(sleepMs);
|
||||
}
|
||||
int32 sleepMs = 1; // Minimum delay to allow thread scheduling
|
||||
if ((newMillis - _lastRenderTime) < _tickLength)
|
||||
sleepMs = _tickLength - (newMillis - _lastRenderTime);
|
||||
assert(sleepMs >= 0);
|
||||
_system->delayMillis(sleepMs);
|
||||
_lastRenderTime = _system->getMillis();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user