summaryrefslogtreecommitdiff
path: root/src/systhread.c
diff options
context:
space:
mode:
authorRobert Pluim <rpluim@gmail.com>2020-01-31 10:22:59 +0100
committerRobert Pluim <rpluim@gmail.com>2020-02-03 16:40:25 +0100
commit831508422e26e6d88dd5d8960e2569c489604c85 (patch)
treed1cb4f413b41c6e7ae570dda44bcfde1a991061d /src/systhread.c
parentf27187f963e9e36435b508e29256e048799e0ff2 (diff)
downloademacs-831508422e26e6d88dd5d8960e2569c489604c85.tar.gz
Cater for 3-argument version of pthread_setname_np
Fixes Bug#39363. * configure.ac: Add check for 3-argument version of pthread_setname_np. * src/systhread.c (sys_thread_set_name) [HAVE_PTHREAD_SETNAME_NP_3ARG]: Call pthread_setname_np with 3 arguments.
Diffstat (limited to 'src/systhread.c')
-rw-r--r--src/systhread.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/systhread.c b/src/systhread.c
index c649ae853a3..0d600d6895e 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -214,11 +214,13 @@ sys_thread_set_name (const char *name)
char p_name[TASK_COMM_LEN];
strncpy (p_name, name, TASK_COMM_LEN - 1);
p_name[TASK_COMM_LEN - 1] = '\0';
- #ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
+# ifdef HAVE_PTHREAD_SETNAME_NP_1ARG
pthread_setname_np (p_name);
- #else
+# elif defined HAVE_PTHREAD_SETNAME_NP_3ARG
+ pthread_setname_np (pthread_self (), "%s", p_name);
+# else
pthread_setname_np (pthread_self (), p_name);
- #endif
+# endif
#endif
}