Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8309408

Thread.sleep cleanup

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 22
    • None
    • core-libs
    • b03

    Description

      Thread.sleep used to be a sleepy place but there has been a bit of churn in the code recently to support virtual threads, add sleep(Duration), a JFR event, changing the underlying implementation to support sub-millis precision, and changeing the 2-arg sleep to make use of it. The changes have settled down now so we can do some cleanups that came up in PR discussions:

      - Add a private sleepNanos method that creates/commits the JFR event around the sleep, this avoids duplicate code in the 3 sleep methods.
      - 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.

      Attachments

        Issue Links

          Activity

            People

              alanb Alan Bateman
              alanb Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: