Revert "Make gCrashRecoveryEnabled thread local"

This reverts commit 5e77ea04f214c7a18bd5c782c8b8a7b7c828ad7a.

Causes a breakage on Windows buildbot.
This commit is contained in:
Jacques Pienaar 2021-02-10 13:36:10 -08:00
parent 606c3be85d
commit d650365935

View File

@ -84,7 +84,8 @@ public:
};
} // 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;