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