When you allocate some TLS for thread A in a slot, can you then access that same slot from Thread B?
Is it internally synchronized or how does that work?
The local variables of a function are unique to each thread that runs the function. This can be accomplished with help of TLS which as already mentioned is local for each thread. If you want to share some data between threads there are several options starting from using global or static variables up to memory mapped files and etc... also check thread synchronization if you need to share data between threads.
The following diagram illustrates how TLS works.
For more details check MSDN.

(source: microsoft.com)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With