[llvm] d650365 - Revert "Make gCrashRecoveryEnabled thread local"
Jacques Pienaar via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 13:37:32 PST 2021
Author: Jacques Pienaar
Date: 2021-02-10T13:36:56-08:00
New Revision: d65036593595551dc7b3cef013c930976851b32a
URL: https://github.com/llvm/llvm-project/commit/d65036593595551dc7b3cef013c930976851b32a
DIFF: https://github.com/llvm/llvm-project/commit/d65036593595551dc7b3cef013c930976851b32a.diff
LOG: Revert "Make gCrashRecoveryEnabled thread local"
This reverts commit 5e77ea04f214c7a18bd5c782c8b8a7b7c828ad7a.
Causes a breakage on Windows buildbot.
Added:
Modified:
llvm/lib/Support/CrashRecoveryContext.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index 64f8b3699ed7..3ee6a4fd36f4 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -84,7 +84,8 @@ struct CrashRecoveryContextImpl {
};
} // namespace
-static LLVM_THREAD_LOCAL bool gCrashRecoveryEnabled = false;
+static ManagedStatic<std::mutex> gCrashRecoveryContextMutex;
+static bool gCrashRecoveryEnabled = false;
static ManagedStatic<sys::ThreadLocal<const CrashRecoveryContext>>
tlIsRecoveringFromCrash;
@@ -135,6 +136,8 @@ CrashRecoveryContext *CrashRecoveryContext::GetCurrent() {
}
void CrashRecoveryContext::Enable() {
+ std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
+ // FIXME: Shouldn't this be a refcount or something?
if (gCrashRecoveryEnabled)
return;
gCrashRecoveryEnabled = true;
@@ -142,6 +145,7 @@ void CrashRecoveryContext::Enable() {
}
void CrashRecoveryContext::Disable() {
+ std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
if (!gCrashRecoveryEnabled)
return;
gCrashRecoveryEnabled = false;
More information about the llvm-commits
mailing list