[Scummvm-cvs-logs] SF.net SVN: scummvm:[55790] scummvm/trunk/engines/toon/toon.cpp
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Sat Feb 5 22:58:44 CET 2011
Revision: 55790
http://scummvm.svn.sourceforge.net/scummvm/?rev=55790&view=rev
Author: tdhs
Date: 2011-02-05 21:58:44 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
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%.
Modified Paths:
--------------
scummvm/trunk/engines/toon/toon.cpp
Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp 2011-02-05 14:45:36 UTC (rev 55789)
+++ scummvm/trunk/engines/toon/toon.cpp 2011-02-05 21:58:44 UTC (rev 55790)
@@ -419,13 +419,13 @@
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();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list