-
Enhancement
-
Resolution: Fixed
-
P4
-
14
-
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.
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.
- blocks
-
JDK-8230423 Move os::sleep to JavaThread::sleep
-
- Resolved
-