* Don't sleep for negative amounts (overflows to very large sleep delays :-)
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 11 Jun 2007 20:00:12 +0000 (22:00 +0200)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 11 Jun 2007 20:00:12 +0000 (22:00 +0200)
ABM2/Engine/Kernel.cpp

index 06269d33183bbd209f78b2b1967a317ab654f98b..35d4afce603cc425a1fe83b2275477380459315b 100755 (executable)
@@ -67,7 +67,9 @@ int CKernel::Execute()
                        }\r
                        IMMObject::CollectGarbage();\r
                        DWORD end_point = GetTickCount();\r
-                       Sleep(50 - (end_point-starting_point));\r
+                       /* Sleep if we didn't use up too much time already */\r
+                       if (starting_point + 50 > end_point)\r
+                               Sleep(50 - (end_point-starting_point));\r
                }\r
 #ifdef _DEBUG\r
                CProfileSample::Output();\r