Commit cad67038 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Enforce SingletonThreadLocal uniqueness without FOLLY_TLS

Summary:
[Folly] Enforce `SingletonThreadLocal` uniqueness also in the case where `FOLLY_TLS` is not defined.

Since the uniqueness check should happen in all scenarios, just move it to a place which is not subject to conditional compilation.

Reviewed By: yfeldblum

Differential Revision: D15142661

fbshipit-source-id: 04dbc7bc775255a010f24c1496552cfc27970e1f
parent 7bfcc8a3
...@@ -158,12 +158,12 @@ class SingletonThreadLocal : private detail::SingletonThreadLocalBase { ...@@ -158,12 +158,12 @@ class SingletonThreadLocal : private detail::SingletonThreadLocalBase {
} }
FOLLY_NOINLINE static Wrapper& getWrapper() { FOLLY_NOINLINE static Wrapper& getWrapper() {
(void)unique; // force the object not to be thrown out as unused
return *getWrapperTL(); return *getWrapperTL();
} }
#ifdef FOLLY_TLS #ifdef FOLLY_TLS
FOLLY_NOINLINE static T& getSlow(Wrapper*& cache) { FOLLY_NOINLINE static T& getSlow(Wrapper*& cache) {
(void)unique; // force the object not to be thrown out as unused
static thread_local Wrapper** check = &cache; static thread_local Wrapper** check = &cache;
CHECK_EQ(check, &cache) << "inline function static thread_local merging"; CHECK_EQ(check, &cache) << "inline function static thread_local merging";
static thread_local bool stale; static thread_local bool stale;
......
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