FastLED 3.9.15
Loading...
Searching...
No Matches

◆ instance()

template<typename T, int N = 0>
static T & fl::SingletonThreadLocal< T, N >::instance ( )
inlinestatic

Definition at line 133 of file singleton.h.

133 {
134 // Aligned char buffer storage — never destroyed
136 char data[sizeof(ThreadLocal<T>)];
137 };
138
139 static AlignedStorage storage;
140 static ThreadLocal<T>* ptr = nullptr;
141 if (!ptr) {
142 ptr = new (&storage.data) ThreadLocal<T>();
143 }
144 // The ThreadLocal container is never destroyed (singleton pattern).
145 // Each thread's createStorage() allocation is intentionally permanent.
146 // Suppress LSAN false positives for per-thread storage allocations.
147#if FL_HAS_SANITIZER_LSAN
149#endif
150 return ptr->access();
151 }

References fl::ThreadLocalFake< T >::access(), fl::FL_ALIGN_AS_T(), and FL_NOEXCEPT.

Referenced by fl::task::detail::await_depth_tls(), fl::third_party::vorbis::get_stbv_temp_buffer(), fl::anonymous_namespace{xypath.cpp.hpp}::get_tls_raster(), fl::getTraceStorage(), instanceRef(), fl::task::run(), and fl::audio::fft::Context::scratch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: