mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
Fix definitions for Darwin PPC; do not use pthread_setname_np on unsupported OS versions (#1797)
* Correct define for Darwin PPC is __POWERPC__ * util.cpp: do not use pthread_setname_np on unsupported macOS versions
This commit is contained in:
parent
e1e4924592
commit
7f98a8b972
|
@ -61,7 +61,7 @@ set(archdetect_c_code "
|
||||||
#else
|
#else
|
||||||
#error cmake_ARCH mips
|
#error cmake_ARCH mips
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) || defined(__POWERPC__) \\
|
||||||
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|
||||||
|| defined(_M_MPPC) || defined(_M_PPC)
|
|| defined(_M_MPPC) || defined(_M_PPC)
|
||||||
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
|
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
# include <AvailabilityMacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -143,8 +146,15 @@ namespace util
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetThreadName (const char *name) {
|
void SetThreadName (const char *name) {
|
||||||
#if defined(__APPLE__) && !defined(__powerpc__)
|
#if defined(__APPLE__)
|
||||||
|
# if (!defined(MAC_OS_X_VERSION_10_6) || \
|
||||||
|
(MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || \
|
||||||
|
defined(__POWERPC__))
|
||||||
|
/* pthread_setname_np is not there on <10.6 and all PPC.
|
||||||
|
So do nothing. */
|
||||||
|
# else
|
||||||
pthread_setname_np((char*)name);
|
pthread_setname_np((char*)name);
|
||||||
|
# endif
|
||||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
pthread_set_name_np(pthread_self(), name);
|
pthread_set_name_np(pthread_self(), name);
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
|
|
Loading…
Reference in a new issue