June 23, 2012 Address of TLS variables | |
|---|---|
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), but is
passing it to other threads OK? Does the language guarantee this?
--
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
| |
June 23, 2012 Re: Address of TLS variables | |
|---|---|
Posted in reply to Alex Rønne Petersen | 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. |

Reply