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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • hotspot
    • b14

      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.

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

              Created:
              Updated:
              Resolved: