是否明确定义了哪个线程调用 thread_local 存储的构造函数?

is it well defined which thread calls constructors of thread_local storage?

c++ 标准是否定义了如何、何时以及由哪个线程调用 thread_local 变量的构造函数?例如,是否总是为其分配 thread_local 数据的线程本身?或者可能是产生新线程的线程?还是进程的第一个线程?或者这取决于编译器?

[basic.start.dynamic] It is implementation-defined whether the dynamic initialization of a non-local non-inline variable with thread storage duration is sequenced before the first statement of the initial function of a thread or is deferred. If it is deferred, the initialization associated with the entity for thread t is sequenced before the first non-initialization odr-use by t of any non-inline variable with thread storage duration defined in the same translation unit as the variable to be initialized. It is implementation-defined in which threads and at which points in the program such deferred dynamic initialization occurs.