1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-06-15 01:44:43 +00:00
parent 6c9ffbf5b3
commit 4060211c96

View file

@ -4861,6 +4861,9 @@ debug_deadlock_check(rb_vm_t *vm, VALUE msg)
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 msg)
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");
}