RFR: 6900441 PlatformEvent.park(millis) on Linux could still be affected by changes to the time-of-day clock
david.holmes at oracle.com
Thu Sep 12 03:00:20 PDT 2013
On 12/09/2013 5:26 PM, Mikael Gerdin wrote:
> (not a review, but I have a comment at the bottom)
> On 2013-09-11 13:06, David Holmes wrote:
>> Short version: use CLOCK_MONOTONIC with pthread_cond_t objects for
>> relative timed-waits.
>> Long version - see below :)
>> 4. CLOCK_MONOTONIC is not in fact completely immune to changes in the
>> time of day clock but it won't jump backwards. The new clock on the
>> block is CLOCK_MONOTONIC_RAW which should always advance at a constant
>> rate with no jumps. We have a RFE to start using CLOCK_MONOTONIC_RAW for
>> System.nanoTime(), and we would use it for the pthread_cond_t too, but
>> we can't use that until the JDK 8 build platform is updated to a linux
>> version that actually has that clock at build time. That update is very
>> near but not yet here so we stay with CLOCK_MONOTONIC.
> It seems like we already handle the fact that the build platform may not
> support CLOCK_MONOTONIC:
> 1371 #ifndef CLOCK_MONOTONIC
> 1372 #define CLOCK_MONOTONIC (1)
> 1373 #endif
> Is there something stopping us from #define:ing CLOCK_MONOTONIC_RAW
> ourselves as well?
Perhaps not, I hadn't considered that.
> Do you plan to remove this #ifndef block when the build platform is
It will get cleaned up at some point but perhaps not until 9.
More information about the hotspot-dev