From d858fa77d684d317b75f2e910f946f5711b68559 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Jun 2014 18:04:05 +0000 Subject: [PATCH] tsan: fix mutex in Go mode In Go it's legal to unlock from a different goroutine. llvm-svn: 210358 --- compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc index efb41f5..4522791 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -198,7 +198,7 @@ int MutexUnlock(ThreadState *thr, uptr pc, uptr addr, bool all) { TraceAddEvent(thr, thr->fast_state, EventTypeUnlock, s->GetId()); int rec = 0; bool report_bad_unlock = false; - if (s->recursion == 0 || s->owner_tid != thr->tid) { + if (kCppMode && (s->recursion == 0 || s->owner_tid != thr->tid)) { if (flags()->report_mutex_bugs && !s->is_broken) { s->is_broken = true; report_bad_unlock = true; -- 2.7.4