Use C++ thread_local for fast-path cache in SingletonThreadLocal
Summary: [Folly] Use C++ `thread_local` for fast-path cache in `SingletonThreadLocal`. Because modules might be `dlclose`'d, use `static thread_local` rather than `static __thread` in the slow path which integrates the dtor into both `dlclose` and thread exit. Because there might be multiple dynamically-loaded modules where the `static __thread` caches cannot be merged into a single cache, let all caches be tracked in a list. We have not found a case where this can happen while at the same time the `StaticSingletonManager` singleton does get merged, but this is at least not strictly wrong. Reviewed By: djwatson Differential Revision: D7316155 fbshipit-source-id: 0bf06638853ed70464856853349445d9fa6eabc0
Showing
Please register or sign in to comment