On Thursday, 4 October 2018 at 13:48:24 UTC, welkam wrote:
Oh so its like thread local globals sort of. My reasoning was that stack is a form of storage and is thread local so...
Thread local storage IS "global" per thread though, instead of per process which "global" is in other languages.
The stack, is... well the stack and has nothing to do with the thread local storage. Although each thread has their own stack, else threads would have to wait for each other every time something was pushed or popped.
Thread local storage is a bit more complex though and very different than regular heap allocations.
See: https://en.wikipedia.org/wiki/Thread-local_storage