[PATCH] D93907: Make gCrashRecoveryEnabled atomic
Jacques Pienaar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 12:41:06 PST 2021
jpienaar updated this revision to Diff 322794.
jpienaar added a comment.
Updated to use thread local variable instead.
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.322794.patch
Type: text/x-patch
Size: 985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210210/77f915af/attachment.bin>
More information about the llvm-commits
mailing list