[PATCH] D14644: [tsan] Fix finalization of detached threads on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 02:36:47 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, glider, samsonov.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp.

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

http://reviews.llvm.org/D14644

Files:
  lib/tsan/rtl/tsan_platform_mac.cc

Index: lib/tsan/rtl/tsan_platform_mac.cc
===================================================================
--- lib/tsan/rtl/tsan_platform_mac.cc
+++ lib/tsan/rtl/tsan_platform_mac.cc
@@ -139,7 +139,7 @@
     }
   } 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();
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14644.40126.patch
Type: text/x-patch
Size: 465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151113/c34d91c5/attachment.bin>


More information about the llvm-commits mailing list