summaryrefslogtreecommitdiff
path: root/src/systhread.c
diff options
context:
space:
mode:
authorTimo Myyrä <timo.myyra@bittivirhe.fi>2020-06-28 10:27:21 +0200
committerMattias Engdegård <mattiase@acm.org>2020-06-28 10:27:21 +0200
commite4028d15153a29966425d93be6374fae770d14a8 (patch)
tree1cfd0e417a7999dfe35091fcace7088a90aedca7 /src/systhread.c
parent5ce5cf643840cd6efd25d987bc5b6f12478c50a6 (diff)
downloademacs-e4028d15153a29966425d93be6374fae770d14a8.tar.gz
Add thread-naming support for OpenBSD
OpenBSD has pthread_set_name_np; FreeBSD appears to have both this call and pthread_setname_np (the latter call is used in preference). * configure.ac: Detect pthread_set_name_np. * sys/systhread.c: Include <pthread_np.h> and call pthread_set_name_np if available.
Diffstat (limited to 'src/systhread.c')
-rw-r--r--src/systhread.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/systhread.c b/src/systhread.c
index 0d600d6895e..ebd75526495 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -26,6 +26,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "nsterm.h"
#endif
+#ifdef HAVE_PTHREAD_SET_NAME_NP
+#include <pthread_np.h>
+#endif
+
#ifndef THREADS_ENABLED
void
@@ -221,6 +225,10 @@ sys_thread_set_name (const char *name)
# else
pthread_setname_np (pthread_self (), p_name);
# endif
+#elif HAVE_PTHREAD_SET_NAME_NP
+ /* The name will automatically be truncated if it exceeds a
+ system-specific length. */
+ pthread_set_name_np (pthread_self (), name);
#endif
}