18template <
typename Func>
19__attribute__((noinline))
auto& ThreadLocal(Func&& factory) {
24 using VariableType = std::invoke_result_t<Func&&>;
26 thread_local VariableType variable{std::forward<Func>(factory)()};
27 VariableType* ptr = &variable;
30 asm volatile(
"" :
"+rm" (ptr));