RFR (S): 8230423: Move os::sleep to JavaThread::sleep
David Holmes
david.holmes at oracle.com
Mon Sep 9 12:37:40 UTC 2019
Hi Robbin,
Thanks for taking a look.
On 9/09/2019 6:38 pm, Robbin Ehn wrote:
> 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* ?
To be honest this was the last part I had to fix because of the movement
of the _SleepEvent and initially I just did a cast then thought that was
too clunky so used the same approach as had earlier been in the sleep
code. Changing the parameter would have been simpler as it turns out.
But this code will only last a few days anyway :)
Thanks,
David
> 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