tsan: fix Go build with TSAN_COLLECT_STATS
authorDmitry Vyukov <dvyukov@google.com>
Fri, 6 Jun 2014 15:50:29 +0000 (15:50 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Fri, 6 Jun 2014 15:50:29 +0000 (15:50 +0000)
Go does not have cur_thread function.

llvm-svn: 210345

compiler-rt/lib/tsan/rtl/tsan_mutex.cc

index 344c7f1..55d6e18 100644 (file)
@@ -234,7 +234,7 @@ void Mutex::Lock() {
       cmp = kUnlocked;
       if (atomic_compare_exchange_weak(&state_, &cmp, kWriteLock,
                                        memory_order_acquire)) {
-#if TSAN_COLLECT_STATS
+#if TSAN_COLLECT_STATS && !TSAN_GO
         StatInc(cur_thread(), stat_type_, backoff.Contention());
 #endif
         return;
@@ -262,7 +262,7 @@ void Mutex::ReadLock() {
   for (Backoff backoff; backoff.Do();) {
     prev = atomic_load(&state_, memory_order_acquire);
     if ((prev & kWriteLock) == 0) {
-#if TSAN_COLLECT_STATS
+#if TSAN_COLLECT_STATS && !TSAN_GO
       StatInc(cur_thread(), stat_type_, backoff.Contention());
 #endif
       return;