RFR: 8309408: Thread.sleep cleanup [v2]

Alan Bateman alanb at openjdk.org
Thu Jun 15 10:30:34 UTC 2023


> Thread.sleep has had quite a bit of churn recently to support virtual threads, add sleep(Duration), a JFR event, and the change the underlying implementation to support sub-millis precision. I think the changes have settled down now so we can do some small cleanups that came up in PR discussions. The cleanups were kicked down the road as it requires tracking down faraway tests that depend on the stack depth and the names of internal methods. The two cleanups proposed here are:
> 
> 1.  Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods.
> 2.  Rename JVM_Sleep to JVM_SleepNanos to make it clear that it takes the sleep time in nanoseconds, esp. when Thread.sleep's parameter is milliseconds.

Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Merge
 - Merge
 - Add beforeSleep/afterSleep to list of expected methods
 - Initial commit

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/14303/files
  - new: https://git.openjdk.org/jdk/pull/14303/files/ae6b531f..593f2a53

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14303&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14303&range=00-01

  Stats: 55233 lines in 963 files changed: 39216 ins; 12904 del; 3113 mod
  Patch: https://git.openjdk.org/jdk/pull/14303.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14303/head:pull/14303

PR: https://git.openjdk.org/jdk/pull/14303


More information about the core-libs-dev mailing list