Some codebases like skia define a static thread_local
global variable. What is the point of having this as opposed to just a thread_local
variable at a namespace
scope?
// From: https://github.com/google/skia/blob/main/src/sksl/SkSLPool.cpp
namespace SkSL {
static thread_local MemoryPool* sMemPool = nullptr;
static MemoryPool* get_thread_local_memory_pool() {
return sMemPool;
}
static void set_thread_local_memory_pool(MemoryPool* memPool) {
sMemPool = memPool;
}
}
What will happen if we remove static
.