A few questions on ScopedValue
Alan Bateman
Alan.Bateman at oracle.com
Tue Jul 18 05:22:49 UTC 2023
On 18/07/2023 01:39, viraj shetty wrote:
> Thanks Alan. Thinking about ScopedValue as an implicit parameter is a
> good insight. Also - the javadoc for the SopedValue does clarify a
> great deal about using with StructuredTaskScope. Thanks for pointing
> me to that.
>
> As I was reading the ScopedValue Javadoc, I had another question. As
> part of the API note - the Javadoc says the following about Thread locals.
>
> "Inheritance
> <https://urldefense.com/v3/__https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/lang/InheritableThreadLocal.html__;!!ACWV5N9M2RV99hQ!JDLXL-nDPUkXz49wIKLp3IsidFtmj2LBVQpuK0f75zRjVUkoucMzmkoDCN0Ki7y_KrG4g9CKQg2H1wTFJEYVqmQ$> is
> expensive - the map of thread-locals to values must be copied when
> creating each child thread."
>
> I assume this is referring to InheritableThreadLocals and not the
> regular ThreadLocals. My understanding is that the regular ThreadLocal
> objects don't get copied over to child threads
>
Yes, that's right.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230718/e0c0b08b/attachment-0001.htm>
More information about the loom-dev
mailing list