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)