[compiler-rt] r206043 - tsan: serialize report printing in standalone deadlock detector

Dmitry Vyukov dvyukov at google.com
Fri Apr 11 10:54:27 PDT 2014


Author: dvyukov
Date: Fri Apr 11 12:54:27 2014
New Revision: 206043

URL: http://llvm.org/viewvc/llvm-project?rev=206043&view=rev
Log:
tsan: serialize report printing in standalone deadlock detector
otherwise reports get intermixed


Modified:
    compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc
    compiler-rt/trunk/lib/tsan/dd/dd_rtl.h

Modified: compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc?rev=206043&r1=206042&r2=206043&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/dd/dd_rtl.cc Fri Apr 11 12:54:27 2014
@@ -39,6 +39,7 @@ static void PrintStackTrace(Thread *thr,
 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 @@ static void ReportDeadlock(Thread *thr,
     }
   }
   Printf("==============================\n");
-  Die();
 }
 
 Callback::Callback(Thread *thr)

Modified: compiler-rt/trunk/lib/tsan/dd/dd_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/dd/dd_rtl.h?rev=206043&r1=206042&r2=206043&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/dd/dd_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/dd/dd_rtl.h Fri Apr 11 12:54:27 2014
@@ -44,6 +44,7 @@ typedef AddrHashMap<Mutex, 31051> MutexH
 struct Context {
   DDetector *dd;
 
+  BlockingMutex report_mutex;
   MutexHashMap mutex_map;
 };
 





More information about the llvm-commits mailing list