A lightweight thread is a Thread

Andrew Haley aph at redhat.com
Wed Oct 23 08:59:48 UTC 2019


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?

-- 
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