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

(thread) Thread.sleep should say "at least as long" and implement this guarantee

XMLWordPrintable

    • generic
    • windows_xp

      Original problem description (addressed now: see evaluation):
      Users are sometimes reading the javadoc for the two Thread sleep methods
      and interpreting it to mean that a program will sleep for *exactly* the
      time they are specifying. In reality, all current implementations have an
      additional delay before the program resumes execution. Several bugs have
      been filed (and closed) about this.

      Current problem description:
      The Thread.sleep spec should say that sleep "Causes the currently executing thread to sleep (temporarily cease execution) for at least the specified number of milliseconds...." (important text is "at least") And the Java SE implementation has rounding policies (e.g. for nanoseconds in sleep's two parameter method) that would not correctly implement this specification change: a code change to implement the "at least" spec properly is also required (see suggested fix).

            psoper Pete Soper (Inactive)
            kwalrathsunw Kathy Walrath (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: