[compiler-rt] r253079 - [tsan] Fix finalization of detached threads on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 12:45:28 PST 2015


Author: kuba.brecka
Date: Fri Nov 13 14:45:27 2015
New Revision: 253079

URL: http://llvm.org/viewvc/llvm-project?rev=253079&view=rev
Log:
[tsan] Fix finalization of detached threads on OS X

Currently, we crash on finalization of detached threads, because we'll try to clear the ThreadState twice.

Differential Revision: http://reviews.llvm.org/D14644


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc?rev=253079&r1=253078&r2=253079&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc Fri Nov 13 14:45:27 2015
@@ -139,7 +139,7 @@ static void my_pthread_introspection_hoo
     }
   } else if (event == PTHREAD_INTROSPECTION_THREAD_DESTROY) {
     ThreadState *thr = cur_thread();
-    if (thr->tctx->parent_tid == kInvalidTid) {
+    if (thr->tctx && thr->tctx->parent_tid == kInvalidTid) {
       DestroyThreadState();
     }
   }




More information about the llvm-commits mailing list