In JDK-6900441 we fixed the park implementation on Linux to use CLOCK_MONOTONIC using pthread_condattr_setclock, which is now required to be available on all supported Linux platforms. However we also allowed for it to fail at runtime:
+ // Only set the clock if CLOCK_MONOTONIC is available
+ if (Linux::supports_monotonic_clock()) {
+ if ((status = pthread_condattr_setclock(_condattr, CLOCK_MONOTONIC)) != 0) {
+ if (status == EINVAL) {
+ warning("Unable to use monotonic clock with relative timed-waits" \
+ " - changes to the time-of-day clock may have adverse affects");
+ } else {
+ fatal(err_msg("pthread_condattr_setclock: %s", strerror(status)));
+ }
+ }
+ }
If we do hit the EINVAL case we simply print the warning, but computeAbsTime and unpackTime will still calculate relative timeouts using CLOCK_MONOTONIC, which is wrong if the pthread_cond_timedwait is actually going to use CLOCK_REALTIME.