summaryrefslogtreecommitdiff
path: root/os_dep.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2020-02-06 12:24:15 +0300
committerIvan Maidanski <ivmai@mail.ru>2020-02-06 13:07:25 +0300
commitab91e4e84d166fb7536056ae95d55c00d2ea2f46 (patch)
tree2aeb2809ddd992011880e66b54275f89326281d9 /os_dep.c
parent9eddcfa3233581e24676967d5734e5a4f1b2c7be (diff)
downloadbdwgc-ab91e4e84d166fb7536056ae95d55c00d2ea2f46.tar.gz
Set name of GC marker threads
Issue #300 (bdwgc). The threads are named as "GC-marker-<n>". For now, the detection of pthread_setname_np availability and kind is implemented in configure only. On Darwin, the GC mprotect thread name is set too. * configure.ac [$THREADS==posix] (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID, HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG, HAVE_PTHREAD_SETNAME_NP_WITH_TID): Check for pthread_setname_np; set the relevant HAVE_x macro. * include/private/gc_priv.h [__CYGWIN__ && GC_THREADS && !_GNU_SOURCE] (_GNU_SOURCE): Define. * os_dep.c [MPROTECT_VDB && DARWIN && HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID] (GC_mprotect_thread): Call pthread_setname_np(). * pthread_support.c [PARALLEL_MARK] (set_marker_thread_name): Define. * win32_threads.c [PARALLEL_MARK] (set_marker_thread_name): Likewise. * pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Call set_marker_thread_name(id). * win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise.
Diffstat (limited to 'os_dep.c')
-rw-r--r--os_dep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/os_dep.c b/os_dep.c
index 22af1fb5..eb6b3326 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -4033,6 +4033,9 @@ STATIC void *GC_mprotect_thread(void *arg)
msg.data[0] = 0;
# endif
+# if defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
+ (void)pthread_setname_np("GC-mprotect");
+# endif
# if defined(THREADS) && !defined(GC_NO_THREADS_DISCOVERY)
GC_darwin_register_mach_handler_thread(mach_thread_self());
# endif