Minor fixes for < 10.6 (#515)

* Fix for missing AI_NUMERICSERV on < 10.6

* Do not use pthread_setname_np on < 10.6
This commit is contained in:
Sergey Fedorov 2024-05-08 22:33:23 +08:00 committed by GitHub
parent 1d210c0139
commit c106e6cb24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,12 @@
#endif #endif
#endif #endif
#ifdef __APPLE__
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0
#endif
#endif
namespace ix namespace ix
{ {
const int64_t DNSLookup::kDefaultWait = 1; // ms const int64_t DNSLookup::kDefaultWait = 1; // ms

View File

@ -15,6 +15,10 @@
#include <pthread_np.h> #include <pthread_np.h>
#endif #endif
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
// Windows // Windows
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -58,7 +62,7 @@ namespace ix
void setThreadName(const std::string& name) void setThreadName(const std::string& name)
{ {
#if defined(__APPLE__) #if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
// //
// Apple reserves 16 bytes for its thread names // Apple reserves 16 bytes for its thread names
// Notice that the Apple version of pthread_setname_np // Notice that the Apple version of pthread_setname_np