1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

timer: workaround for crappy operating systems

Some operating systems apparently can't deal with really long timeouts
in pthread_cond_timedwait(). Passing a time about 300000 in the future
makes the call return immediately. (tv_sec/time_t doesn't overflow in
this situation.) Reduce the wait time to about 100 days, which seems
to work fine.

The list of affected OSes follows: OSX
This commit is contained in:
wm4 2014-05-23 00:20:57 +02:00
parent 2e6b0b4ee4
commit b69d57ebe8

View File

@ -119,6 +119,7 @@ struct timespec mp_time_us_to_timespec(int64_t time_us)
diff_secs += 1;
diff_nsecs -= 1000000000UL;
}
diff_secs = MPMIN(diff_secs, 10000000);
if (diff_secs > MAX_TIME_T - ts.tv_sec)
diff_secs = MAX_TIME_T - ts.tv_sec;
ts.tv_sec += diff_secs;