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

Vladimir Panteleev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #3 from Vladimir Panteleev <[email protected]> ---
No bug here.

path in a TLS variable, so there is one instance per thread.

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.

I'm not sure what you expect - that the order of thread execution is
deterministic? This is of course impossible. Or do you want one instance of
"path" per the entire program, shared across threads? Then move it out of the
TLS into the stack or data segment (but watch out for data races).

--

Reply via email to