Replace usleep with nanosleep for macOS too

This commit is contained in:
Chris Robinson 2017-05-09 18:08:00 -07:00 committed by Christoph Oelckers
parent f492e92cb5
commit 092b339c8f

View file

@ -77,7 +77,12 @@ void I_WaitVBL(const 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;
}