[PATCH] disable monotonic clock if condattr_setclock(CLOCK_MONOTONIC) does not work
Gleb Natapov
gleb at cloudius-systems.com
Thu Jan 16 13:53:34 UTC 2014
If pthread_condattr_setclock(CLOCK_MONOTONIC) fails monotonic clock
cannot be used since otherwise timeout for pthread_cond_timedwait()
is calculated incorrectly which causes it to exit immediately. Fix that
by disabling monotonic clock in case attribute setting fails.
diff -r a3dc98dc4d21 src/os/linux/vm/os_linux.cpp
--- a/src/os/linux/vm/os_linux.cpp Wed Dec 04 23:11:03 2013 -0800
+++ b/src/os/linux/vm/os_linux.cpp Thu Jan 16 15:19:58 2014 +0200
@@ -4762,6 +4762,7 @@
if (status == EINVAL) {
warning("Unable to use monotonic clock with relative timed-waits" \
" - changes to the time-of-day clock may have adverse affects");
+ Linux::_clock_gettime = NULL;
} else {
fatal(err_msg("pthread_condattr_setclock: %s", strerror(status)));
}
--
Gleb.
More information about the hotspot-gc-dev
mailing list