Reduce CPU usage

This commit is contained in:
David Rosca 2021-09-03 14:03:59 +02:00
commit 2ff9a129c0
No known key found for this signature in database
GPG key ID: EBC3FC294452C6D8
2 changed files with 3 additions and 1 deletions

View file

@ -649,6 +649,7 @@ public:
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
}
while(next_frame > now) {
std::this_thread::sleep_for(1ns);
now = std::chrono::steady_clock::now();
}
next_frame = now + delay;
@ -769,6 +770,7 @@ public:
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
}
while(next_frame > now) {
std::this_thread::sleep_for(1ns);
now = std::chrono::steady_clock::now();
}
next_frame = now + delay;