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.
This commit is contained in:
antirez 2020-04-20 12:17:11 +02:00
parent 85d1d1f870
commit c7db333abb

View File

@ -234,8 +234,14 @@ void setproctitle(const char *fmt, ...);
#include <pthread_np.h>
#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 <pthread.h>
#define redis_set_thread_title(name) pthread_setname_np(name)
#else
#define redis_set_thread_title(name)
#endif
#endif
#endif
#endif