diff options
| author | Timo Myyrä | 2020-06-28 10:27:21 +0200 |
|---|---|---|
| committer | Mattias Engdegård | 2020-06-28 10:27:21 +0200 |
| commit | e4028d15153a29966425d93be6374fae770d14a8 (patch) | |
| tree | 1cfd0e417a7999dfe35091fcace7088a90aedca7 /src | |
| parent | 5ce5cf643840cd6efd25d987bc5b6f12478c50a6 (diff) | |
| download | emacs-e4028d15153a29966425d93be6374fae770d14a8.tar.gz emacs-e4028d15153a29966425d93be6374fae770d14a8.zip | |
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')
| -rw-r--r-- | src/systhread.c | 8 |
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/>. */ | |||
| 26 | #include "nsterm.h" | 26 | #include "nsterm.h" |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | #ifdef HAVE_PTHREAD_SET_NAME_NP | ||
| 30 | #include <pthread_np.h> | ||
| 31 | #endif | ||
| 32 | |||
| 29 | #ifndef THREADS_ENABLED | 33 | #ifndef THREADS_ENABLED |
| 30 | 34 | ||
| 31 | void | 35 | void |
| @@ -221,6 +225,10 @@ sys_thread_set_name (const char *name) | |||
| 221 | # else | 225 | # else |
| 222 | pthread_setname_np (pthread_self (), p_name); | 226 | pthread_setname_np (pthread_self (), p_name); |
| 223 | # endif | 227 | # endif |
| 228 | #elif HAVE_PTHREAD_SET_NAME_NP | ||
| 229 | /* The name will automatically be truncated if it exceeds a | ||
| 230 | system-specific length. */ | ||
| 231 | pthread_set_name_np (pthread_self (), name); | ||
| 224 | #endif | 232 | #endif |
| 225 | } | 233 | } |
| 226 | 234 | ||