tsan: serialize report printing in standalone deadlock detector
otherwise reports get intermixed
llvm-svn: 206043
diff --git a/compiler-rt/lib/tsan/dd/dd_rtl.cc b/compiler-rt/lib/tsan/dd/dd_rtl.cc
index 7f3c75e..729e79e 100644
--- a/compiler-rt/lib/tsan/dd/dd_rtl.cc
+++ b/compiler-rt/lib/tsan/dd/dd_rtl.cc
@@ -39,6 +39,7 @@
static void ReportDeadlock(Thread *thr, DDReport *rep) {
if (rep == 0)
return;
+ BlockingMutexLock lock(&ctx->report_mutex);
Printf("==============================\n");
Printf("WARNING: lock-order-inversion (potential deadlock)\n");
for (int i = 0; i < rep->n; i++) {
@@ -52,7 +53,6 @@
}
}
Printf("==============================\n");
- Die();
}
Callback::Callback(Thread *thr)
diff --git a/compiler-rt/lib/tsan/dd/dd_rtl.h b/compiler-rt/lib/tsan/dd/dd_rtl.h
index 45d456e..ec77766 100644
--- a/compiler-rt/lib/tsan/dd/dd_rtl.h
+++ b/compiler-rt/lib/tsan/dd/dd_rtl.h
@@ -44,6 +44,7 @@
struct Context {
DDetector *dd;
+ BlockingMutex report_mutex;
MutexHashMap mutex_map;
};