JDK-8230422 : Convert uninterruptible os::sleep calls to os::naked_short_sleep
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-02
  • Updated: 2019-09-26
  • Resolved: 2019-09-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b14Fixed
Related Reports
Blocks :  
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.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/d8902e9c307c User: dholmes Date: 2019-09-07 22:50:56 +0000
07-09-2019