summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-01-07 17:08:25 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-01-07 17:57:31 +0100
commit73fd8a4b535928990f24702cdfaeeeceb6d33d3d (patch)
tree56cd425a191c863f87cd4d2b0742464fea8b540a /src/thread.c
parentf54b24304decc52defbf12576993d746e02a80ee (diff)
downloademacs-73fd8a4b535928990f24702cdfaeeeceb6d33d3d.tar.gz
Fix BSD and macOS builds w.r.t. pthread_setname_np (bug#38632)
pthread_setname_np takes only a single argument on BSD and macOS, and affects the current thread only. * configure.ac: Add check for single-argument pthread_setname_np * src/systhread.c (sys_thread_set_name): New (w32 and pthread versions). (sys_thread_create): Remove name argument and name-setting. (w32_beginthread_wrapper): Remove name-setting. * src/systhread.h (sys_thread_create, sys_thread_set_name): Update prototypes. * src/thread.c (run_thread): Call sys_thread_set_name. (Fmake_thread): Adapt call to sys_thread_create. * src/thread.h (struct thread_state): Adjust comment.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/thread.c b/src/thread.c
index f7e39dc4273..c7fe0614269 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -725,6 +725,9 @@ run_thread (void *state)
self->m_stack_bottom = self->stack_top = (char *) &stack_pos;
self->thread_id = sys_thread_self ();
+ if (self->thread_name)
+ sys_thread_set_name (self->thread_name);
+
acquire_global_lock (self);
/* Put a dummy catcher at top-level so that handlerlist is never NULL.
@@ -832,7 +835,7 @@ If NAME is given, it must be a string; it names the new thread. */)
else
new_thread->thread_name = NULL;
sys_thread_t thr;
- if (! sys_thread_create (&thr, c_name, run_thread, new_thread))
+ if (! sys_thread_create (&thr, run_thread, new_thread))
{
/* Restore the previous situation. */
all_threads = all_threads->next_thread;