digitalmars.D.learn - Address of TLS variables
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (9/9) Jun 23 2012 Hi,
- Timon Gehr (6/12) Jun 23 2012 I'd assume that it results in a pointer to the original thread's TLS
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
Jun 23 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.
Jun 23 2012