[Issue 17476] Static fields don't seem to be reliably initialized when using parallel()

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 7 09:31:17 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17476

Mathias Lang <mathias.lang at sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathias.lang at sociomantic.co
                   |                            |m

--- Comment #4 from Mathias Lang <mathias.lang at sociomantic.com> ---
> In main, you set the TLS instance of path corresponding to the main thread to "foobar". The "parallel" loop body will use the current thread's TLS instance, but because the order of execution of threads is of course undefined, you get inconsistent results.

So you can implicitly capture TLS variables and use them from other thread ?
Doesn't that completely defeat the purpose of thread locality ?

--


More information about the Digitalmars-d-bugs mailing list