aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/platform/posix/posix_thread.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/platform/posix/posix_thread.c b/src/platform/posix/posix_thread.c
index 0178455f..fe21c3b5 100644
--- a/src/platform/posix/posix_thread.c
+++ b/src/platform/posix/posix_thread.c
@@ -256,13 +256,7 @@ nni_plat_thr_is_self(nni_plat_thr *thr)
void
nni_plat_thr_set_name(nni_plat_thr *thr, const char *name)
{
-#if defined(NNG_HAVE_PTHREAD_SET_NAME_NP)
- if (thr == NULL) {
- pthread_set_name_np(pthread_self(), name);
- } else {
- pthread_set_name_np(thr->tid, name);
- }
-#elif defined(NNG_HAVE_PTHREAD_SETNAME_NP)
+#if defined(NNG_HAVE_PTHREAD_SETNAME_NP)
#if defined(__APPLE__)
// Darwin is weird, it can only set the name of pthread_self.
if ((thr == NULL) || (pthread_self() == thr->tid)) {
@@ -270,11 +264,17 @@ nni_plat_thr_set_name(nni_plat_thr *thr, const char *name)
}
#else
if (thr == NULL) {
- pthread_setname_np(pthread_self(), name);
+ pthread_setname_np(pthread_self(), name);
} else {
- pthread_setname_np(thr->tid, name);
+ pthread_setname_np(thr->tid, name);
}
#endif
+#elif defined(NNG_HAVE_PTHREAD_SET_NAME_NP)
+ if (thr == NULL) {
+ pthread_set_name_np(pthread_self(), name);
+ } else {
+ pthread_set_name_np(thr->tid, name);
+ }
#endif
}