diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2020-02-06 12:24:15 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2020-02-06 13:07:25 +0300 |
commit | ab91e4e84d166fb7536056ae95d55c00d2ea2f46 (patch) | |
tree | 2aeb2809ddd992011880e66b54275f89326281d9 /os_dep.c | |
parent | 9eddcfa3233581e24676967d5734e5a4f1b2c7be (diff) | |
download | bdwgc-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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 |