[Openmp-commits] [openmp] [OpenMP] Rename worker threads for improved debuggability (PR #102065)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 7 17:47:39 PDT 2024


================
@@ -878,6 +878,13 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) {
     KMP_SYSFAIL("pthread_create", status);
   }
 
+#if defined(KMP_OS_LINUX) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
+  // Rename worker threads for improved debuggability
+  if (!KMP_UBER_GTID(gtid)) {
+    pthread_setname_np(handle, "openmp_worker");
----------------
shiltian wrote:

If this is the case, I'd suggest to use the CMake feature [`CheckSymbolExists`](https://cmake.org/cmake/help/latest/module/CheckSymbolExists.html#module:CheckSymbolExists).

https://github.com/llvm/llvm-project/pull/102065


More information about the Openmp-commits mailing list