Address of TLS variables
Timon Gehr
timon.gehr at gmx.ch
Sat Jun 23 13:10:46 PDT 2012
On 06/23/2012 09:51 PM, Alex Rønne Petersen wrote:
> Hi,
>
> Does taking the address of a TLS variable and passing it to other
> threads have defined semantics? I would assume it results in a pointer
> to the thread's instance of the TLS variable (which makes sense),
I'd assume that it results in a pointer to the original thread's TLS
variable, because threads usually share the physical address space.
> but is passing it to other threads OK?
I think you could pass a T* function() thunk that takes the respective
TLS variable's address instead, if that makes sense.
> Does the language guarantee this?
>
No, it is probably implementation/architecture dependent.
More information about the Digitalmars-d-learn
mailing list