aboutsummaryrefslogtreecommitdiff
path: root/openmp/runtime/src/z_Linux_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/src/z_Linux_util.cpp')
-rw-r--r--openmp/runtime/src/z_Linux_util.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index 337a345..bdb7a12 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -71,6 +71,9 @@
#if KMP_OS_NETBSD
#include <sched.h>
#endif
+#if KMP_OS_OPENBSD
+#include <pthread_np.h>
+#endif
#elif KMP_OS_SOLARIS
#include <libproc.h>
#include <procfs.h>
@@ -878,12 +881,18 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) {
KMP_SYSFAIL("pthread_create", status);
}
-#ifdef LIBOMP_HAVE_LINUX_PTHREAD_SETNAME
// Rename worker threads for improved debuggability
if (!KMP_UBER_GTID(gtid)) {
+#if defined(LIBOMP_HAVE_PTHREAD_SET_NAME_NP)
+ pthread_set_name_np(handle, "openmp_worker");
+#elif defined(LIBOMP_HAVE_PTHREAD_SETNAME_NP) && !KMP_OS_DARWIN
+#if KMP_OS_NETBSD
+ pthread_setname_np(handle, "%s", const_cast<char *>("openmp_worker"));
+#else
pthread_setname_np(handle, "openmp_worker");
- }
#endif
+#endif
+ }
th->th.th_info.ds.ds_thread = handle;