summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-23 00:20:57 +0200
committerwm4 <wm4@nowhere>2014-05-23 00:20:57 +0200
commitb69d57ebe87cb43ea29ce7b7146d63338b7ed3e7 (patch)
tree802156fbf53b1531afe32d14e7113eb807f9af82
parent2e6b0b4ee47d227bcc1d32d23859532592b33386 (diff)
downloadmpv-b69d57ebe87cb43ea29ce7b7146d63338b7ed3e7.tar.bz2
mpv-b69d57ebe87cb43ea29ce7b7146d63338b7ed3e7.tar.xz
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
-rw-r--r--osdep/timer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/osdep/timer.c b/osdep/timer.c
index 583a94c28a..8dd5915b72 100644
--- a/osdep/timer.c
+++ b/osdep/timer.c
@@ -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;