[PATCH] D30526: [Support] Add functions to get and set thread name.

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 04:34:10 PST 2017


labath added a comment.

Thank you, it looks much better. Let me know what you think about the name.



================
Comment at: llvm/include/llvm/Support/Threading.h:133
+
+  uint64_t get_threadid_np();
+
----------------
I'd remove the `_np` suffix. It is present on the pthread functions to differentiate them from other `pthread_***` functions, which are expected to behave the same on all conforming implementations. Since the purpose of this function is to provide a *portable* wrapper around different versions of those functions, having the suffix here seems wrong.


================
Comment at: llvm/lib/Support/Unix/Threading.inc:100
+#else
+  return uint64_t(pthread_self());
+#endif
----------------
I am wondering whether this is a useful fallback. pthread_t is used in completely different contexts than OS-level thread handles, so it may be better to just return 0 or something here. I don't feel strongly about it though.


https://reviews.llvm.org/D30526





More information about the llvm-commits mailing list