mirror of https://github.com/mpv-player/mpv
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:
parent
2e6b0b4ee4
commit
b69d57ebe8
|
@ -119,6 +119,7 @@ struct timespec mp_time_us_to_timespec(int64_t time_us)
|
||||||
diff_secs += 1;
|
diff_secs += 1;
|
||||||
diff_nsecs -= 1000000000UL;
|
diff_nsecs -= 1000000000UL;
|
||||||
}
|
}
|
||||||
|
diff_secs = MPMIN(diff_secs, 10000000);
|
||||||
if (diff_secs > MAX_TIME_T - ts.tv_sec)
|
if (diff_secs > MAX_TIME_T - ts.tv_sec)
|
||||||
diff_secs = MAX_TIME_T - ts.tv_sec;
|
diff_secs = MAX_TIME_T - ts.tv_sec;
|
||||||
ts.tv_sec += diff_secs;
|
ts.tv_sec += diff_secs;
|
||||||
|
|
Loading…
Reference in New Issue