[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:33:33 PDT 2017


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

--- Comment #5 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Mathias Lang from comment #4)
> So you can implicitly capture TLS variables and use them from other thread ?
> Doesn't that completely defeat the purpose of thread locality ?

I don't understand your question.

If you want to always refer to the main thread's TLS instance of "path" inside
the parallel foreach body, you can explicitly save a copy or a pointer to it
outside the foreach body on main's stack, then refer to it inside the foreach
body.

--


More information about the Digitalmars-d-bugs mailing list