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

Convert uninterruptible os::sleep calls to os::naked_short_sleep

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 14
    • Fix Version/s: 14
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b14

      Description

      At present os::sleep has a path for JavaThreads that is interruptible and deals with safepoints and suspension, and a path for non-JavaThreads that is uninterruptible and independent of safepoints and suspension. That usage still uses the per-thread _SleepEvent (PlatformEvent).

      In addition we have os::naked_short_sleep(millis) for uninterruptible sleeps of up to 1 second, which uses the platform "sleep" primitive.

      If we convert all the uninterruptible os::sleep uses into os::naked_short_sleep we gain a number of benefits:
      - os::sleep is simplified and operates only on JavaThreads
      - only JavaThreads need the _SleepEvent so we can remove it from other threads (future RFE)
      - non-JavaThread call sites no longer need to manifest Thread::current to do the sleep

      Some uses of os::sleep exceed the 1 second limit of os::naked_short_sleep, but this can easily be accommodated by a os::naked_sleep wrapper around os::naked_short_sleep.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dholmes David Holmes
                Reporter:
                dholmes David Holmes
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: