From ddb2ff7303982b19adb0a23707722e3ca4ece1d2 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 28 Dec 2017 13:46:27 +0900 Subject: [PATCH] thread_pthread.c: set MJIT thread name thread_win32.c: ditto --- thread_pthread.c | 6 +++++- thread_win32.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/thread_pthread.c b/thread_pthread.c index f8c1480a814d68..0e4ed67380770c 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1798,6 +1798,9 @@ mjit_worker(void *arg) if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0) { fprintf(stderr, "Cannot enable cancelation in MJIT worker\n"); } +#ifdef SET_CURRENT_THREAD_NAME + SET_CURRENT_THREAD_NAME("ruby-mjitworker"); /* 16 byte including NUL */ +#endif worker_func(); return NULL; } @@ -1816,7 +1819,8 @@ rb_thread_create_mjit_thread(void (*child_hook)(void), void (*worker_func)(void) /* jit_worker thread is not to be joined */ pthread_detach(worker_pid); return TRUE; - } else { + } + else { return FALSE; } } diff --git a/thread_win32.c b/thread_win32.c index 045029f11252c0..fe73e35fb0eaef 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -781,6 +781,7 @@ static unsigned long __stdcall mjit_worker(void *arg) { void (*worker_func)(void) = arg; + rb_w32_set_thread_description(GetCurrentThread(), L"ruby-mjitworker"); worker_func(); return 0; }