Commit c7db333a authored by antirez's avatar antirez
Browse files

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.
parent 85d1d1f8
...@@ -234,8 +234,14 @@ void setproctitle(const char *fmt, ...); ...@@ -234,8 +234,14 @@ void setproctitle(const char *fmt, ...);
#include <pthread_np.h> #include <pthread_np.h>
#define redis_set_thread_title(name) pthread_set_name_np(pthread_self(), name) #define redis_set_thread_title(name) pthread_set_name_np(pthread_self(), name)
#else #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) #define redis_set_thread_title(name)
#endif #endif
#endif #endif
#endif
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment