RFR (S): 8230423: Move os::sleep to JavaThread::sleep

Robbin Ehn robbin.ehn at oracle.com
Mon Sep 9 08:38:01 UTC 2019


Hi David,

3598 void os::interrupt(Thread* thread) {
3599   debug_only(Thread::check_for_dangling_thread_pointer(thread);)
3600   assert(thread->is_Java_thread(), "invariant");
3601   JavaThread* jt = (JavaThread*) thread;

Why not change the argument type to JavaThread* ?

Thanks, Robbin

On 9/9/19 7:21 AM, David Holmes wrote:
> bug: https://bugs.openjdk.java.net/browse/JDK-8230423
> webrev: http://cr.openjdk.java.net/~dholmes/8230423/webrev/
> 
> This is the next step in the sleep/interrupt support code reshuffle. Now that 
> os::sleep is platform independent and only applicable to JavaThreads, we can 
> move it to JavaThread as an instance method.
> 
> Summary of changes:
> - os::sleep moved to JavaThread::sleep as instance method
> - signature changed to return bool - true means timed-out; false means interrupted
> - rearranged the sleep code slightly to remove the initial back-to-back 
> nanoTime() calls - as suggested by Roger.
> - _SleepEvent moved from Thread to JavaThread
> - minor changes to os::interrupt to account for move to JavaThread (this code 
> will also be moved to JavaThread in the next fix)
> - call sites changed from os::sleep(t,ms) to t->sleep(ms)
> 
> Testing:
>   - tiers 1-3
> 
> Thanks,
> David


More information about the hotspot-dev mailing list