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

David Holmes david.holmes at oracle.com
Tue Sep 10 08:52:24 UTC 2019


Thanks Robbin!

David

On 10/09/2019 6:37 pm, Robbin Ehn wrote:
>>>>
>>>> Why not change the argument type to JavaThread* ?
>>
>> The interrupt code is all being changed in an upcoming fix so I didn't 
>> worry too much about the mechanisms at this stage.
> 
> 
> Ok, looks fine, thanks!
> 
> /Robbin
> 
>>
>> David
>> -----
>>
>>> 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