From c7db333abb0e45ff8974ef2d1fc4f9ae1e7be1e2 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 20 Apr 2020 12:17:11 +0200 Subject: [PATCH] Implement redis_set_thread_title for MacOS. Strange enough, pthread_setname_np() produces a warning for not defined function even if pthread is included. Moreover the MacOS documentation claims the return value for the function is void, but actually is int. Related to #7089. --- src/config.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config.h b/src/config.h index 82dc201d3..40dc683ce 100644 --- a/src/config.h +++ b/src/config.h @@ -234,8 +234,14 @@ void setproctitle(const char *fmt, ...); #include #define redis_set_thread_title(name) pthread_set_name_np(pthread_self(), name) #else +#if (defined __APPLE__ && defined(MAC_OS_X_VERSION_10_7)) +int pthread_setname_np(const char *name); +#include +#define redis_set_thread_title(name) pthread_setname_np(name) +#else #define redis_set_thread_title(name) #endif #endif +#endif #endif