From 1fe09f8e753b97be53cd0f2958b200c1fef3af9c Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 3 Dec 2015 02:57:14 +0000 Subject: configure.in: split SET_THREAD_NAME * configure.in: separate SET_CURRENT_THREAD_NAME, which can set the name of current thread only, and SET_ANOTHER_THREAD_NAME, which can set the name of other threads. * thread.c (rb_thread_setname): use SET_ANOTHER_THREAD_NAME. OS X is not possible to set another thread name. * thread_pthread.c (native_set_thread_name, thread_timer): use SET_CURRENT_THREAD_NAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 3804590cc5..6638d53d21 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1481,15 +1481,14 @@ timer_thread_sleep(rb_global_vm_lock_t* unused) } #endif /* USE_SLEEPY_TIMER_THREAD */ -#if defined(__linux__) && defined(PR_SET_NAME) -# undef SET_THREAD_NAME -# define SET_THREAD_NAME(name) prctl(PR_SET_NAME, name) +#if !defined(SET_CURRENT_THREAD_NAME) && defined(__linux__) && defined(PR_SET_NAME) +# define SET_CURRENT_THREAD_NAME(name) prctl(PR_SET_NAME, name) #endif static void native_set_thread_name(rb_thread_t *th) { -#ifdef SET_THREAD_NAME +#ifdef SET_CURRENT_THREAD_NAME if (!th->first_func && th->first_proc) { VALUE loc = rb_proc_location(th->first_proc); if (!NIL_P(loc)) { @@ -1512,7 +1511,7 @@ native_set_thread_name(rb_thread_t *th) buf[sizeof(buf)-2] = '*'; buf[sizeof(buf)-1] = '\0'; } - SET_THREAD_NAME(buf); + SET_CURRENT_THREAD_NAME(buf); } } #endif @@ -1525,8 +1524,8 @@ thread_timer(void *p) if (TT_DEBUG) WRITE_CONST(2, "start timer thread\n"); -#ifdef SET_THREAD_NAME - SET_THREAD_NAME("ruby-timer-thr"); +#ifdef SET_CURRENT_THREAD_NAME + SET_CURRENT_THREAD_NAME("ruby-timer-thr"); #endif #if !USE_SLEEPY_TIMER_THREAD -- cgit v1.2.3