Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274976

(loom) Spec of Thread.Builder.inheritInheritableThreadLocals could be improved

    XMLWordPrintable

Details

    Description

      The spec for `Thread.Builder.inheritInheritableThreadLocals` is:

      “Sets whether the thread inherits the initial values of inheritable-thread-local variables. The default is to inherit.
      The initial values of InheritableThreadLocals are never inherited when allowSetThreadLocals(boolean) is used to disallow the thread to have its own copy of thread-local variables.”

      https://github.com/openjdk/loom/blob/4406b8ee7233d4765f5e1b27d09e9fb0b1e09dbe/src/java.base/share/classes/java/lang/Thread.java#L869

      In fact what's inherited (or not) is not “the initial TL's value” but “the current value” (the one set lately) that might be different from the original initial value for a TL.

      Attachments

        Activity

          People

            alanb Alan Bateman
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: