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

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 23:55:11 PST 2017


davide added a comment.

The FreeBSD related bits are correct. The whole chain of `#ifdef` is a little nasty, but I'm not sure there's an easy way to avoid it.



================
Comment at: llvm/lib/Support/Threading.cpp:158-170
+#if defined(__linux__)
+#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
+  ::pthread_setname_np(::pthread_self(), NameStr.c_str());
+#endif
+#elif defined(__FreeBSD__)
+  ::pthread_set_name_np(::pthread_self(), NameStr.c_str());
+#elif defined(__NetBSD__)
----------------
I'm wondering if there's a way to avoid this ugly `#ifdef` dance.


https://reviews.llvm.org/D30526





More information about the llvm-commits mailing list