diff options
author | David Turner | 2011-02-05 21:58:44 +0000 |
---|---|---|
committer | David Turner | 2011-02-05 21:58:44 +0000 |
commit | 36b6d961c202f4a6c06b362159f41b06a2d18248 (patch) | |
tree | 332894ea65a345641dd3e55f947f234e95bbf868 | |
parent | e990453a4d675eb801f06828a3736b150ef06596 (diff) | |
download | scummvm-rg350-36b6d961c202f4a6c06b362159f41b06a2d18248.tar.gz scummvm-rg350-36b6d961c202f4a6c06b362159f41b06a2d18248.tar.bz2 scummvm-rg350-36b6d961c202f4a6c06b362159f41b06a2d18248.zip |
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
-rw-r--r-- | engines/toon/toon.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index d7168c2843..e26303eed1 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -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(); } |