JDK10 RFR: 8165437 Evaluate the use of gettimeofday in Networking code

Roger Riggs Roger.Riggs at Oracle.com
Wed Apr 12 14:47:56 UTC 2017


Hi Vyom,

Thanks for taking this on.   I have a few comments and questions.

In aix_close.c line 547 The code for if (nanoTimeout >= NSEC_PER_MSEC) 
seems ineffective.

The update of nanoTime at 549-550 ensures the timeout is > NSEC_PER_MSEC 
if it loops.
On the first pass through the code if nanoTimeout was < NSEC_PER_MSEC it 
would
poll with a timeout of zero which returns immediately, EINTR is not 
possible.

The comment at 546 would be inaccurate if nanoTimeout is too small, 
because it will loop again.

I think the behavior would be the same if the extra condition at 547 is 
removed.

Most of the other xxx_close.c classes have the same structure.

PlainSocketImpl.c has the same structure


The bsd_close.c had the same kind of before and after checking but did 
previously
and conservatively I'd keep that structure though I think it was 
ineffective in that case too.

Thanks, Roger




On 4/11/2017 9:04 AM, Vyom Tewari wrote:
> Hi,
>
> Please review the code change for below issue.
>
> Bug:       https://bugs.openjdk.java.net/browse/JDK-8165437
>
> Webrev: http://cr.openjdk.java.net/~vtewari/8165437/webrev0.5/index.html
>
> This change will replace the "gettimeofday" to use the monotonic 
> increasing clock(i used the existing function "JVM_NanoTime" instead 
> of writing my own).
>
> Thanks,
>
> Vyom
>
>



More information about the net-dev mailing list