[PATCH] D18951: [sanitizer] Use pthread_threadid_np as thread ID on OS X

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 07:44:30 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266991: [sanitizer] Use pthread_threadid_np as thread ID on OS X (authored by kuba.brecka).

Changed prior to commit:
  http://reviews.llvm.org/D18951?vs=53204&id=54503#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18951

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc

Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -230,7 +230,10 @@
 }
 
 uptr GetTid() {
-  return reinterpret_cast<uptr>(pthread_self());
+  // FIXME: This can potentially get truncated on 32-bit, where uptr is 4 bytes.
+  uint64_t tid;
+  pthread_threadid_np(nullptr, &tid);
+  return tid;
 }
 
 void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18951.54503.patch
Type: text/x-patch
Size: 576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/d53313c5/attachment.bin>


More information about the llvm-commits mailing list