I'd like to better understand thread_local before I use it in my code.
Let's say, I declare
thread_local myclass value;
That will create new instance of myclass for each thread that is using the value? What happens when the thread exits? Will the instance be freed or is it going to remain somewhere in the memory? When will be called the destructor?
Does thread_local lock the constructor so that only one can be called at any moment in time?