tsan: serialize report printing in standalone deadlock detector

otherwise reports get intermixed

llvm-svn: 206043
This commit is contained in:
Dmitry Vyukov
2014-04-11 17:54:27 +00:00
parent 3bdcb52dd1
commit 51f5b5fd73
2 changed files with 2 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ static void PrintStackTrace(Thread *thr, u32 stk) {
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, DDReport *rep) {
}
}
Printf("==============================\n");
Die();
}
Callback::Callback(Thread *thr)

View File

@@ -44,6 +44,7 @@ typedef AddrHashMap<Mutex, 31051> MutexHashMap;
struct Context {
DDetector *dd;
BlockingMutex report_mutex;
MutexHashMap mutex_map;
};