Fix folly::ThreadLocal to have unique singleton in dev builds
authorAndrii Grynenko <andrii@fb.com>
Fri, 26 Feb 2016 18:28:31 +0000 (10:28 -0800)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Fri, 26 Feb 2016 18:35:27 +0000 (10:35 -0800)
commita7d7c07cadb5d5e9d55d5dd97b3e6069afe21245
treee76675593f48328b316acad4c99cf94f251627db
parent398424e8b83eaf0ee91b1dbbead7fed4ab09c439
Fix folly::ThreadLocal to have unique singleton in dev builds

Summary:This re-uses StaticSingletonManager which was previously used to fix the same issue in folly::Singleton.

Because of the same issue we can no longer use static thread_local for the ThreadEntry. We now rely on pthread_getspecific/pthread_setspecific instead and use static thread_local ThreadEntry* only as a cache (to improve perf).

Reviewed By: yfeldblum

Differential Revision: D2978526

fb-gh-sync-id: cf1d9044afc27b62bd50a1ed931c0c420ae7107e
shipit-source-id: cf1d9044afc27b62bd50a1ed931c0c420ae7107e
folly/Makefile.am
folly/Singleton.cpp
folly/Singleton.h
folly/detail/StaticSingletonManager.cpp [new file with mode: 0644]
folly/detail/StaticSingletonManager.h [new file with mode: 0644]
folly/detail/ThreadLocalDetail.h