mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
Fix handling long wait times on POSIX's I_WaitVBL
usleep only works for sleeping up to one second. The function is also deprecated and nanosleep should be used instead.
This commit is contained in:
parent
fd8613a11e
commit
7ad61a97ed
1 changed files with 6 additions and 1 deletions
|
@ -113,7 +113,12 @@ void I_WaitVBL (int count)
|
|||
{
|
||||
// I_WaitVBL is never used to actually synchronize to the
|
||||
// vertical blank. Instead, it's used for delay purposes.
|
||||
usleep (1000000 * count / 70);
|
||||
struct timespec delay, rem;
|
||||
delay.tv_sec = count / 70;
|
||||
/* Avoid overflow. Microsec res should be good enough. */
|
||||
delay.tv_nsec = (count%70)*1000000/70 * 1000;
|
||||
while(nanosleep(&delay, &rem) == -1 && errno == EINTR)
|
||||
delay = rem;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue