ruby-changes:43345
From: nobu <ko1@a...>
Date: Wed, 15 Jun 2016 10:44:50 +0900 (JST)
Subject: [ruby-changes:43345] nobu:r55419 (trunk): thread.c: fix thread_id formatting
nobu 2016-06-15 10:44:43 +0900 (Wed, 15 Jun 2016) New Revision: 55419 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55419 Log: thread.c: fix thread_id formatting * thread.c (debug_deadlock_check): fix format specifier for thread_id, which may not be a pointer, nor even a scalar value. Modified files: trunk/thread.c Index: thread.c =================================================================== --- thread.c (revision 55418) +++ thread.c (revision 55419) @@ -4861,6 +4861,9 @@ debug_deadlock_check(rb_vm_t *vm, VALUE https://github.com/ruby/ruby/blob/trunk/thread.c#L4861 rb_str_catf(msg, "\n%d threads, %d sleeps current:%p main thread:%p\n", vm_living_thread_num(vm), vm->sleeper, GET_THREAD(), vm->main_thread); list_for_each(&vm->living_threads, th, vmlt_node) { + rb_str_catf(msg, "* %+"PRIsVALUE"\n rb_thread_t:%p " + "native:%"PRI_THREAD_ID" int:%u", + th->self, th, thread_id_str(th), th->interrupt_flag); if (th->locking_mutex) { rb_mutex_t *mutex; struct rb_thread_struct volatile *mth; @@ -4871,23 +4874,16 @@ debug_deadlock_check(rb_vm_t *vm, VALUE https://github.com/ruby/ruby/blob/trunk/thread.c#L4874 mth = mutex->th; waiting = mutex->cond_waiting; native_mutex_unlock(&mutex->lock); - rb_str_catf(msg, "* %+"PRIsVALUE"\n rb_thread_t:%p native:%p int:%u mutex:%p cond:%d\n", - th->self, th, th->thread_id, - th->interrupt_flag, mth, waiting); - } - else { - rb_str_catf(msg, "* %+"PRIsVALUE"\n rb_thread_t:%p native:%p int:%u\n", - th->self, th, th->thread_id, - th->interrupt_flag); + rb_str_catf(msg, " mutex:%p cond:%d", mth, waiting); } { rb_thread_list_t *list = th->join_list; while (list) { - rb_str_catf(msg, " depended by: tb_thread_id:%p\n", list->th); + rb_str_catf(msg, "\n depended by: tb_thread_id:%p", list->th); list = list->next; } } - rb_str_catf(msg, " "); + rb_str_catf(msg, "\n "); rb_str_concat(msg, rb_ary_join(rb_vm_backtrace_str_ary(th, 0, 0), sep)); rb_str_catf(msg, "\n"); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/