diff options
author | Kuba Mracek <mracek@apple.com> | 2017-04-17 18:17:38 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-04-17 18:17:38 +0000 |
commit | 0f9f15db742f9abe6141df0819cd0fd577c06a3d (patch) | |
tree | 3720c792c577c29d1369fec7c88842dd6a57f563 /lib/sanitizer_common/sanitizer_mac.cc | |
parent | 9e60082e3f68e8619ffc917bbdaaf0636c3fcaa3 (diff) |
[sanitizer] Introduce tid_t as a typedef for OS-provided thread IDs
We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD).
Differential Revision: https://reviews.llvm.org/D31774
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_mac.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_mac.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc index 34af4e918..2f990b805 100644 --- a/lib/sanitizer_common/sanitizer_mac.cc +++ b/lib/sanitizer_common/sanitizer_mac.cc @@ -252,9 +252,8 @@ bool FileExists(const char *filename) { return S_ISREG(st.st_mode); } -uptr GetTid() { - // FIXME: This can potentially get truncated on 32-bit, where uptr is 4 bytes. - uint64_t tid; +tid_t GetTid() { + tid_t tid; pthread_threadid_np(nullptr, &tid); return tid; } |