[compiler-rt] a776717 - tsan: switch atexit mutex to the normal Mutex
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 23 00:13:42 PDT 2021
Author: Dmitry Vyukov
Date: 2021-07-23T09:13:37+02:00
New Revision: a7767171cb79da42fb67d394929535e7bb4a6813
URL: https://github.com/llvm/llvm-project/commit/a7767171cb79da42fb67d394929535e7bb4a6813
DIFF: https://github.com/llvm/llvm-project/commit/a7767171cb79da42fb67d394929535e7bb4a6813.diff
LOG: tsan: switch atexit mutex to the normal Mutex
Now that Mutex is blocking there is no point in using BlockingMutex.
Switch to Mutex.
Depends on D106379.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D106560
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index aaca967c3874..dd2442842795 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -196,12 +196,10 @@ struct InterceptorContext {
unsigned finalize_key;
#endif
- BlockingMutex atexit_mu;
+ Mutex atexit_mu;
Vector<struct AtExitCtx *> AtExitStack;
- InterceptorContext()
- : libignore(LINKER_INITIALIZED), AtExitStack() {
- }
+ InterceptorContext() : libignore(LINKER_INITIALIZED), atexit_mu(MutexTypeAtExit), AtExitStack() {}
};
static ALIGNED(64) char interceptor_placeholder[sizeof(InterceptorContext)];
@@ -377,7 +375,7 @@ static void at_exit_wrapper() {
AtExitCtx *ctx;
{
// Ensure thread-safety.
- BlockingMutexLock l(&interceptor_ctx()->atexit_mu);
+ Lock l(&interceptor_ctx()->atexit_mu);
// Pop AtExitCtx from the top of the stack of callback functions
uptr element = interceptor_ctx()->AtExitStack.Size() - 1;
@@ -433,7 +431,7 @@ static int setup_at_exit_wrapper(ThreadState *thr, uptr pc, void(*f)(),
// Store ctx in a local stack-like structure
// Ensure thread-safety.
- BlockingMutexLock l(&interceptor_ctx()->atexit_mu);
+ Lock l(&interceptor_ctx()->atexit_mu);
// __cxa_atexit calls calloc. If we don't ignore interceptors, we will fail
// due to atexit_mu held on exit from the calloc interceptor.
ScopedIgnoreInterceptors ignore;
More information about the llvm-commits
mailing list