From 4048c91bf7862ba15fb8f132328f6fb1cf06cde1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 27 Dec 2020 21:54:45 -0800 Subject: fixes #1363 build ios version fails --- src/platform/posix/posix_thread.c | 18 +++++++++--------- 1 file 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 } -- cgit v1.2.3-70-g09d2