Let's use pthread_threadid_np which returns a more reasonable ID than pthread_self (which is actually a stack pointer). The numbers from pthread_threadid_np are already used in other tools, e.g. in LLDB, and often appear in logs, so it's much more useful than pthread_self.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/sanitizer_common/sanitizer_mac.cc | ||
---|---|---|
233 ↗ | (On Diff #53204) | Is it OK that the value is potentially truncated? |
lib/sanitizer_common/sanitizer_mac.cc | ||
---|---|---|
233 ↗ | (On Diff #53204) | Hm. It's really just an incrementing thread counter in the kernel. Truncating this can only be an issue after the system created 2^32 threads. This sounds unlikely. On the other hand, would it be a problem to change GetTid to return u64? |
lib/sanitizer_common/sanitizer_mac.cc | ||
---|---|---|
233 ↗ | (On Diff #53204) | Yeah, it's probably unlikely on a 32-bit system. And I think we use it only for reporting, so a truncated id should not break anything. Up to you. |