Skip to content

Commit

Permalink
Throw in some sanity checks of usleep
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 20, 2024
1 parent 53cfecf commit 96dcf40
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Core/HLE/sceDisplay.cpp
Expand Up @@ -484,7 +484,9 @@ static void DoFrameIdleTiming() {
sleep_ms(1);
#else
const double left = goal - cur_time;
usleep((long)(left * 1000000));
if (left > 0.0f && left < 1.0f) { // Sanity check
usleep((long)(left * 1000000));
}
#endif
}

Expand Down Expand Up @@ -743,7 +745,9 @@ void hleLagSync(u64 userdata, int cyclesLate) {
// Tight loop on win32 - intentionally, as timing is otherwise not precise enough.
#ifndef _WIN32
const double left = goal - now;
usleep((long)(left * 1000000.0));
if (left > 0.0f && left < 1.0f) { // Sanity check
usleep((long)(left * 1000000.0));
}
#else
yield();
#endif
Expand Down

0 comments on commit 96dcf40

Please sign in to comment.