where is the storage of thread_local variables in memory ? Is it heap ?
I have implemented a per-thread basis bootstrap function for our application, something like:
thread_local bool bootstrapped_ = false; void Bootstrap() { if (bootstrapped_) return; thread_local ContextTable contexts; contexts_ = &contexts; thread_local IndexMapper indexer; indexer_ = &indexer; } ContextTable* Contexts() { if (!bootstrapped_) Bootstrap(); return contexts_; } extern IndexMapper* Indexer() { if (!bootstrapped_) Bootstrap(); return indexer_; } In the source code above, where is the memory for variables bootstrapped_ , contexts and indexer allocated ?