summaryrefslogtreecommitdiff
path: root/src/config.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-04-20 12:17:11 +0200
committerantirez <antirez@gmail.com>2020-04-20 12:18:37 +0200
commitc7db333abb0e45ff8974ef2d1fc4f9ae1e7be1e2 (patch)
treedf327003d96e7a5e83ba23c934b86cbc44605e11 /src/config.h
parent85d1d1f8700a050ef3178a2d5f5757f9aa77476b (diff)
downloadredis-c7db333abb0e45ff8974ef2d1fc4f9ae1e7be1e2.tar.gz
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.
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h6
1 files changed, 6 insertions, 0 deletions
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 <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