Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v12]

2023-05-03 Thread Aleksey Shipilev
On Thu, 27 Apr 2023 09:40:46 GMT, Aleksey Shipilev wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The pull request now contains 26 commits: >> >> - Merge branch 'master' into JDK-83050920-thread-sleep-subms >> - Merge branch

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v12]

2023-05-02 Thread David Holmes
On Thu, 27 Apr 2023 09:40:46 GMT, Aleksey Shipilev wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The pull request now contains 26 commits: >> >> - Merge branch 'master' into JDK-83050920-thread-sleep-subms >> - Merge branch

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v12]

2023-04-27 Thread Aleksey Shipilev
On Wed, 26 Apr 2023 20:22:54 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v12]

2023-04-26 Thread David Holmes
On Wed, 26 Apr 2023 20:22:54 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v12]

2023-04-26 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v11]

2023-04-25 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v10]

2023-04-22 Thread Alan Bateman
On Fri, 21 Apr 2023 13:21:09 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v10]

2023-04-21 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v7]

2023-04-21 Thread Alan Bateman
On Thu, 20 Apr 2023 08:12:50 GMT, Aleksey Shipilev wrote: >> src/java.base/share/classes/java/lang/Thread.java line 1: >> >>> 1: /* >> >> Why doesn't `Thread.sleep(long millis)` simply call `Thread.sleep(millis, >> 0)` instead of duplicating most of the code? > > That would change the stack

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread Aleksey Shipilev
On Thu, 20 Apr 2023 12:28:56 GMT, David Holmes wrote: >> Hm, "later" where? Because I see the call to `pthread_condwait_timed` right >> after we produced abstime using `nanos_to_nanos_bounded`, and this looks >> like the last opportunity to handle the `MAX_SECS` limit: >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread David Holmes
On Thu, 20 Apr 2023 12:09:18 GMT, Aleksey Shipilev wrote: >> src/hotspot/os/posix/os_posix.cpp line 1342: >> >>> 1340: } >>> 1341: >>> 1342: static jlong nanos_to_nanos_bounded(jlong nanos) { >> >> I don't think we actually need this for nanos. There is no overflow >> potential and the

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread Aleksey Shipilev
On Thu, 20 Apr 2023 12:04:38 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Handle overflows > > src/hotspot/os/posix/os_posix.cpp line 1342: > >> 1340: } >> 1341: >> 1342: static jlong

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread David Holmes
On Thu, 20 Apr 2023 09:29:43 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread Aleksey Shipilev
On Thu, 20 Apr 2023 09:29:43 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v9]

2023-04-20 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v8]

2023-04-20 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v7]

2023-04-20 Thread Aleksey Shipilev
On Thu, 20 Apr 2023 02:14:53 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Adjust test times > > src/hotspot/os/windows/os_windows.cpp line 5263: > >> 5261: if (nanos_left > 0) { >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v7]

2023-04-19 Thread David Holmes
On Wed, 19 Apr 2023 19:55:38 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v5]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 18:50:27 GMT, Alan Bateman wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Windows fixes: align(...) is only for power-of-two alignments > > test/jdk/java/lang/Thread/SleepSanity.java line

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v7]

2023-04-19 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v5]

2023-04-19 Thread Alan Bateman
On Wed, 19 Apr 2023 16:02:08 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v6]

2023-04-19 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v5]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 16:32:05 GMT, ExE Boss wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Windows fixes: align(...) is only for power-of-two alignments > > src/java.base/share/classes/java/lang/Thread.java

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v5]

2023-04-19 Thread ExE Boss
On Wed, 19 Apr 2023 16:02:08 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v5]

2023-04-19 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v4]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 09:56:44 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread David Holmes
On Wed, 19 Apr 2023 09:51:48 GMT, Aleksey Shipilev wrote: >> src/hotspot/os/posix/os_posix.cpp line 1545: >> >>> 1543: >>> 1544: int PlatformEvent::park_nanos(jlong nanos) { >>> 1545: assert(0 <= nanos, "nanos are in range"); >> >> `nanos` should never be zero else you call the untimed

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v4]

2023-04-19 Thread David Holmes
On Wed, 19 Apr 2023 09:56:44 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 06:07:04 GMT, David Holmes wrote: > You seemed to have missed: > > ``` > ./cpu/x86/rdtsc_x86.cpp:JavaThread::current()->sleep(FT_SLEEP_MILLISECS); > ./share/compiler/compileBroker.cpp: sleep(DeoptimizeObjectsALotInterval); > ``` > > so not sure how this is building ???

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 09:27:49 GMT, Alan Bateman wrote: > You might need to check that > test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo001/ownedMonitorsStackDepthInfo001a.java > is passing. I haven't tried your changes but I

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v4]

2023-04-19 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 06:14:37 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix gtests > > src/hotspot/os/posix/os_posix.cpp line 1545: > >> 1543: >> 1544: int

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 05:58:11 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix gtests > > src/hotspot/os/windows/os_windows.cpp line 5253: > >> 5251: >> 5252: int

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 05:58:35 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix gtests > > src/hotspot/os/windows/os_windows.cpp line 5259: > >> 5257: // any positive requested nanos as a

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 06:12:02 GMT, David Holmes wrote: >> Hmmm I changed that comment ... > > My actual comment was changed to: >> I suggest extending the comment to add > > This is how Thread.sleep(millis, nanos) has always behaved with only > millisecond granularity. Reworded, added comment.

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Alan Bateman
On Tue, 18 Apr 2023 19:38:12 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 08:15:44 GMT, Alan Bateman wrote: >> 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

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Aleksey Shipilev
On Wed, 19 Apr 2023 05:50:00 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix gtests > > test/jdk/java/lang/Thread/SleepSanity.java line 75: > >> 73: } >> 74: >> 75: private

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread Alan Bateman
On Wed, 19 Apr 2023 05:43:19 GMT, David Holmes 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 =

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread David Holmes
On Wed, 19 Apr 2023 06:09:28 GMT, David Holmes wrote: >> src/hotspot/os/windows/os_windows.cpp line 5257: >> >>> 5255: // Windows timers are still quite unpredictable to handle >>> sub-millisecond granularity. >>> 5256: // Instead of implementing this method, fall back to the >>>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread David Holmes
On Wed, 19 Apr 2023 05:31:08 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix gtests > > src/hotspot/os/windows/os_windows.cpp line 5257: > >> 5255: // Windows timers are still quite

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-19 Thread David Holmes
On Tue, 18 Apr 2023 19:38:12 GMT, Aleksey Shipilev wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v3]

2023-04-18 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v2]

2023-04-18 Thread Aleksey Shipilev
On Wed, 29 Mar 2023 19:57:46 GMT, Alan Bateman wrote: >> Yes, let me fix that. `TimeUnit.toNanos` handles it well itself, it seems. > >> Yes, let me fix that. `TimeUnit.toNanos` handles it well itself, it seems. > > This code is refactored in PR 13203 so we'll have to merge at some point.

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v2]

2023-04-18 Thread Aleksey Shipilev
On Thu, 30 Mar 2023 01:26:36 GMT, David Holmes wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The pull request now contains ten commits: >> >> - Merge branch 'master' into JDK-83050920-thread-sleep-subms >> - Work >> - Draft

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v2]

2023-04-18 Thread Aleksey Shipilev
On Wed, 12 Apr 2023 07:44:38 GMT, Alan Bateman wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The pull request now contains ten commits: >> >> - Merge branch 'master' into JDK-83050920-thread-sleep-subms >> - Work >> - Draft

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity [v2]

2023-04-18 Thread Aleksey Shipilev
> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up > `nanos` to 1ms when doing the actual sleep. This means users

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-04-12 Thread Alan Bateman
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread David Holmes
On Wed, 29 Mar 2023 17:17:29 GMT, Aleksey Shipilev wrote: > Are there specific factors which would make it unreasonable to implement > `sleep` in terms of `parkNanos`? You would need to reissue any unparks received whilst sleeping. Sleeping and parking are distinct thread states so it would

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread David Holmes
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Alan Bateman
On Wed, 29 Mar 2023 18:29:18 GMT, Aleksey Shipilev wrote: > Yes, let me fix that. `TimeUnit.toNanos` handles it well itself, it seems. This code is refactored in PR 13203 so we'll have to merge at some point. - PR Review Comment:

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Aleksey Shipilev
On Wed, 29 Mar 2023 18:10:30 GMT, Alan Bateman wrote: >> Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The >> documentation for that method clearly says the precision and accuracy are >> dependent on the underlying system behavior. However, it always rounds up >>

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Sergey Tsypanov
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Alan Bateman
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread David M . Lloyd
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Aleksey Shipilev
On Wed, 29 Mar 2023 16:48:41 GMT, David M. Lloyd wrote: > Are there specific factors which would make it unreasonable to implement > `sleep` in terms of `parkNanos`? After reading the Javadoc for `LockSupport`, I don't believe implementing `Thread.sleep` with `LockSupport.parkNanos` is a

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Aleksey Shipilev
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Roger Riggs
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

Re: RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread David M . Lloyd
On Wed, 29 Mar 2023 11:28:53 GMT, Aleksey Shipilev wrote: > Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The > documentation for that method clearly says the precision and accuracy are > dependent on the underlying system behavior. However, it always rounds up >

RFR: 8305092: Improve Thread.sleep(millis, nanos) for sub-millisecond granularity

2023-03-29 Thread Aleksey Shipilev
Java API has the `Thread.sleep(millis, nanos)` method exposed to users. The documentation for that method clearly says the precision and accuracy are dependent on the underlying system behavior. However, it always rounds up `nanos` to 1ms when doing the actual sleep. This means users cannot do