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

Use static FOLLY_TLS ThreadEntry to avoid an ASAN deadlock due to new after fork

Summary: Use static FOLLY_TLS ThreadEntry to avoid an ASAN deadlock due to new after fork

Reviewed By: philippv

Differential Revision: D8272580

fbshipit-source-id: e2dc069e81d15f14be9f96a26d30de7482ced0cf
parent 79bd4f82
...@@ -183,7 +183,9 @@ void StaticMetaBase::onThreadExit(void* ptr) { ...@@ -183,7 +183,9 @@ void StaticMetaBase::onThreadExit(void* ptr) {
tmp->elementsCapacity = 0; tmp->elementsCapacity = 0;
} }
#ifndef FOLLY_TLD_USE_FOLLY_TLS
delete tmp; delete tmp;
#endif
} }
#ifndef FOLLY_TLD_USE_FOLLY_TLS #ifndef FOLLY_TLD_USE_FOLLY_TLS
......
...@@ -447,8 +447,8 @@ struct StaticMeta : StaticMetaBase { ...@@ -447,8 +447,8 @@ struct StaticMeta : StaticMetaBase {
if (!threadEntry) { if (!threadEntry) {
ThreadEntryList* threadEntryList = StaticMeta::getThreadEntryList(); ThreadEntryList* threadEntryList = StaticMeta::getThreadEntryList();
#ifdef FOLLY_TLD_USE_FOLLY_TLS #ifdef FOLLY_TLD_USE_FOLLY_TLS
static FOLLY_TLS ThreadEntry* one; static FOLLY_TLS ThreadEntry threadEntrySingleton;
threadEntry = FOLLY_LIKELY(!!one) ? one : (one = new ThreadEntry()); threadEntry = &threadEntrySingleton;
#else #else
threadEntry = new ThreadEntry(); threadEntry = new ThreadEntry();
#endif #endif
......
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