aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-03 02:57:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-03 02:57:14 +0000
commit1fe09f8e753b97be53cd0f2958b200c1fef3af9c (patch)
treeb94c80436228816673beda30e099769541ffe5b4 /thread_pthread.c
parentb4162e1c255769c6678ad67468745ca8dccecac7 (diff)
downloadruby-1fe09f8e753b97be53cd0f2958b200c1fef3af9c.tar.gz
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
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c13
1 files changed, 6 insertions, 7 deletions
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