summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 16:07:07 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 16:07:07 +0000
commit260d1ac2ca8711971c48e14bd535aeeb20f6ed1d (patch)
treeefc07355499fc1baedbfeab41893d0e2edd214d7 /thread_pthread.c
parent59d521ade472e31affb1b3e925343adb95c89dd8 (diff)
merge revision(s) 54598,54600: [Backport #12290]
* thread.c (get_initialized_threadptr): extract ensuring that the thread is initialized. * thread.c (rb_thread_setname): thread must be initialized to set the name. [ruby-core:74963] [Bug #12290] * thread.c (rb_thread_setname): defer setting native thread name set in initialize until the native thread is created. [ruby-core:74963] [Bug #12290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index a070434afe..4aa2d620a2 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1505,8 +1505,11 @@ native_set_thread_name(rb_thread_t *th)
{
#ifdef SET_CURRENT_THREAD_NAME
if (!th->first_func && th->first_proc) {
- VALUE loc = rb_proc_location(th->first_proc);
- if (!NIL_P(loc)) {
+ VALUE loc;
+ if (!NIL_P(loc = th->name)) {
+ SET_CURRENT_THREAD_NAME(RSTRING_PTR(loc));
+ }
+ else if (!NIL_P(loc = rb_proc_location(th->first_proc))) {
const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Fixnum ] */
char *name, *p;
char buf[16];