X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ABM2%2FEngine%2FKernel.cpp;h=35d4afce603cc425a1fe83b2275477380459315b;hb=5ddbdf638ea3b2fe93de5b7746ac827c21fc5633;hp=12afa65230fd612f541dab224d80d41d0ce834bb;hpb=c3e81e6b78efc4eefdf1837c894edd6022e1d58a;p=matthijs%2FABM2.git diff --git a/ABM2/Engine/Kernel.cpp b/ABM2/Engine/Kernel.cpp index 12afa65..35d4afc 100755 --- a/ABM2/Engine/Kernel.cpp +++ b/ABM2/Engine/Kernel.cpp @@ -27,19 +27,22 @@ int CKernel::Execute() { #ifdef WIN32 MSG msg; +#endif // WIN32 while(taskList.size()) { { PROFILE("Kernel task loop"); - //DWORD starting_point = GetTickCount(); + DWORD starting_point = GetTickCount(); +#ifdef WIN32 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } +#endif // WIN32 std::list< CMMPointer >::iterator it, thisIt; @@ -63,14 +66,15 @@ int CKernel::Execute() } } IMMObject::CollectGarbage(); - //DWORD end_point = GetTickCount(); -// Sleep(50 - (end_point-starting_point)); + DWORD end_point = GetTickCount(); + /* Sleep if we didn't use up too much time already */ + if (starting_point + 50 > end_point) + Sleep(50 - (end_point-starting_point)); } #ifdef _DEBUG CProfileSample::Output(); #endif } -#endif // WIN32 return 0; }