A lightweight thread is a Thread

Andrew Haley aph at redhat.com
Wed Oct 23 17:41:29 UTC 2019


On 10/23/19 10:38 AM, Remi Forax wrote:
> 
>> De: "Andrew Haley" <aph at redhat.com>

>> On 10/22/19 5:27 PM, David Lloyd wrote:
>>> One would still have to allow subclassing of threads though IMO, even
>>> in the lightweight case.  This is enormously useful
>>
>> What is it about subclassing Thread that is enormously useful? I can't
>> immediately think of any case where a scoped local couldn't achieve the
>> same thing. Instead of
>>
>>   (MyFoo)Thread.current();
>>
>> you'd have
>>
>>   CurrentFoo.get();
>>
>> ... which would work in lightweight and heavyweight Threads. Is there
>> something that definitely wouldn't work with this mechanism ?
> 
> all codes that already exist :)
> 
> being able to just do a super(..., /*lightweight*/ true) to use a lightweight thread instead of an heavyweight one without having to rewrite all the client code of that subclass of Thread that already exist.

I should have perhaps said "except legacy". If we're going to support all of
the current properties of Thread we might as well cancel this project now.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the loom-dev mailing list