RFR (XXS): 8066896: Update c.o.j.t.InfiniteLoop to skip zero timeout

Pavel Chistyakov pavel.chistyakov at oracle.com
Fri Dec 19 05:52:28 UTC 2014


Hi, Vladimir

It's a little confusing corner case: to call sleep w/ 0 (zero) => expecting not to have any pause.
If we call sleep w/ any other value then we expect some pause.

So, in this case we need to prevent any pause. For this reason I added a conditional sleep call. 

---------
Thanks,
Pavel

----- Original Message -----
From: vladimir.kozlov at oracle.com
To: hotspot-compiler-dev at openjdk.java.net
Sent: Friday, December 12, 2014 12:57:29 AM GMT +04:00 Abu Dhabi / Muscat
Subject: Re: RFR (XXS): 8066896: Update c.o.j.t.InfiniteLoop to skip zero timeout

Why it is a problem?

   /**
     * Class which runs another Runnable in infinite loop with certain pauses
     * between cycles.
     */

It does not say that it will not pause for few instructions to execute Thread.sleep(0).

Thanks,
Vladimir

On 12/9/14 8:50 AM, Pavel Chistyakov wrote:
> Hi all,
>
> please review changes for: https://bugs.openjdk.java.net/browse/JDK-8066896
> webrev: http://cr.openjdk.java.net/~iignatyev/pchistyakov/8066896/webrev.00/
> <http://cr.openjdk.java.net/%7Eiignatyev/pchistyakov/8066896/webrev.00/>
>
> Problem:
> InfiniteLoop allows zero value as timeout and waste time for Thread.sleep(0) call that is not needed in this case.
>
> Solution:
> Add a condition for skipping 0 (zero) timeout when calling Thread.sleep
>
> Testing: manual
>
> -------------------
> Thanks,
> Pavel


More information about the hotspot-compiler-dev mailing list