RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]
Alan Bateman
alanb at openjdk.org
Wed Apr 19 08:18:52 UTC 2023
On Wed, 19 Apr 2023 05:43:19 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix gtests
>
> src/java.base/share/classes/java/lang/Thread.java line 576:
>
>> 574: long millis = NANOSECONDS.toMillis(nanos);
>> 575: nanos -= MILLISECONDS.toNanos(millis);
>> 576: sleep(millis, (int)nanos);
>
> This double conversion seems a bit kludgy - why not just keep the vthread check and call `sleep0(nanos)`?
Yes, I wondering that too as the method has the sleep time in nanos already so more readable to just call sleep0(nanos).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13225#discussion_r1170984132
More information about the core-libs-dev
mailing list