Commit 77c09b50 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Split getWrapperTL from getWrapper in SingletonThreadLocal

Summary:
[Folly] Split `getWrapperTL` from `getWrapper` in `SingletonThreadLocal`.

Allows hypothetical future changes to operate on the `ThreadLocal<Wrapper>` singleton itself, in addition to the existing code which operates on the `Wrapper` per-thread-singleton.

Reviewed By: djwatson

Differential Revision: D7316099

fbshipit-source-id: 80a8b7ce28da1bc64b204292032766c648f15944
parent 7882c205
...@@ -96,9 +96,13 @@ class SingletonThreadLocal { ...@@ -96,9 +96,13 @@ class SingletonThreadLocal {
} }
}; };
FOLLY_EXPORT FOLLY_NOINLINE static ThreadLocal<Wrapper>& getWrapperTL() {
static auto& entry = *detail::createGlobal<ThreadLocal<Wrapper>, Tag>();
return entry;
}
FOLLY_EXPORT FOLLY_NOINLINE static Wrapper& getWrapper() { FOLLY_EXPORT FOLLY_NOINLINE static Wrapper& getWrapper() {
static auto entry = detail::createGlobal<ThreadLocal<Wrapper>, Tag>(); return *getWrapperTL();
return **entry;
} }
FOLLY_ALWAYS_INLINE static Wrapper& getSlow(Wrapper*& cache) { FOLLY_ALWAYS_INLINE static Wrapper& getSlow(Wrapper*& cache) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment