thread.c: defer setting name in initialize

* 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/trunk@54600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-04-15 13:30:03 +00:00
parent ffd0301a35
commit 4bf8fa83b7
4 changed files with 25 additions and 26 deletions

View file

@ -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];