int busyTime = 10; // 10 ms
int idleTime = busyTime; // same ratio will lead to 50% cpu usage
Int64 startTime = 0;
while(true)
{
startTime = GetTickCount();
// busy loop
while((GetTickCount() - startTime) <= busyTime)
;
// idle loop
Sleep(idleTime);
}