[PATCH] D93907: Make gCrashRecoveryEnabled thread local

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 12:46:16 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e77ea04f214: Make gCrashRecoveryEnabled thread local (authored by jpienaar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93907/new/

https://reviews.llvm.org/D93907

Files:
  llvm/lib/Support/CrashRecoveryContext.cpp


Index: llvm/lib/Support/CrashRecoveryContext.cpp
===================================================================
--- llvm/lib/Support/CrashRecoveryContext.cpp
+++ llvm/lib/Support/CrashRecoveryContext.cpp
@@ -84,8 +84,7 @@
 };
 } // namespace
 
-static ManagedStatic<std::mutex> gCrashRecoveryContextMutex;
-static bool gCrashRecoveryEnabled = false;
+static LLVM_THREAD_LOCAL bool gCrashRecoveryEnabled = false;
 
 static ManagedStatic<sys::ThreadLocal<const CrashRecoveryContext>>
        tlIsRecoveringFromCrash;
@@ -136,8 +135,6 @@
 }
 
 void CrashRecoveryContext::Enable() {
-  std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
-  // FIXME: Shouldn't this be a refcount or something?
   if (gCrashRecoveryEnabled)
     return;
   gCrashRecoveryEnabled = true;
@@ -145,7 +142,6 @@
 }
 
 void CrashRecoveryContext::Disable() {
-  std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
   if (!gCrashRecoveryEnabled)
     return;
   gCrashRecoveryEnabled = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93907.322798.patch
Type: text/x-patch
Size: 985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210210/903e62e6/attachment.bin>


More information about the llvm-commits mailing list