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:
parent
85d1d1f870
commit
c7db333abb
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user