[PATCH] D72305: [TSan] The "thread_terminate" is delivered on the terminating thread

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 15:12:58 PST 2020


yln created this revision.
Herald added subscribers: llvm-commits, Sanitizers, jfb.
Herald added projects: Sanitizers, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72305

Files:
  compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp


Index: compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
+++ compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
@@ -219,11 +219,10 @@
       ThreadStart(thr, tid, GetTid(), ThreadType::Worker);
     }
   } else if (event == PTHREAD_INTROSPECTION_THREAD_TERMINATE) {
-    if (thread == pthread_self()) {
-      ThreadState *thr = cur_thread();
-      if (thr->tctx) {
-        DestroyThreadState();
-      }
+    CHECK(thread == pthread_self());
+    ThreadState *thr = cur_thread();
+    if (thr->tctx) {
+      DestroyThreadState();
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72305.236467.patch
Type: text/x-patch
Size: 660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200106/dab7668c/attachment.bin>


More information about the llvm-commits mailing list