[Openmp-commits] [openmp] [OpenMP] Rename worker threads for improved debuggability (PR #102065)
Matthias Braun via Openmp-commits
openmp-commits at lists.llvm.org
Wed Aug 7 11:32:07 PDT 2024
================
@@ -878,6 +878,15 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) {
KMP_SYSFAIL("pthread_create", status);
}
+#ifdef KMP_OS_LINUX
+#if ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
+ // Rename worker threads for improved debuggability
+ if (!KMP_UBER_GTID(gtid)) {
+ pthread_setname_np(handle, "openmp_worker");
+ }
+#endif
+#endif
----------------
MatzeB wrote:
You can simplify this
```suggestion
#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");
}
#endif
```
https://github.com/llvm/llvm-project/pull/102065
More information about the Openmp-commits
mailing list