method
inspect
v2_4_6 -
Show latest stable
- Class:
Thread
inspect()public
Dump the name, id, and status of thr to a string.
static VALUE
rb_thread_inspect(VALUE thread)
{
VALUE cname = rb_class_path(rb_obj_class(thread));
rb_thread_t *th;
const char *status;
VALUE str;
GetThreadPtr(thread, th);
status = thread_status_name(th, TRUE);
str = rb_sprintf("#<%"PRIsVALUE":%p", cname, (void *)thread);
if (!NIL_P(th->name)) {
rb_str_catf(str, "@%"PRIsVALUE, th->name);
}
if (!th->first_func && th->first_proc) {
VALUE loc = rb_proc_location(th->first_proc);
if (!NIL_P(loc)) {
const VALUE *ptr = RARRAY_CONST_PTR(loc);
rb_str_catf(str, "@%"PRIsVALUE":%"PRIsVALUE, ptr[0], ptr[1]);
rb_gc_force_recycle(loc);
}
}
rb_str_catf(str, " %s>", status);
OBJ_INFECT(str, thread);
return str;
} Related methods
- Instance methods
- []
- []=
- abort_on_exception
- abort_on_exception=
- add_trace_func
- alive?
- backtrace
- backtrace_locations
- exit
- group
- inspect
- join
- key?
- keys
- kill
- name
- name=
- pending_interrupt?
- priority
- priority=
- raise
- report_on_exception
- report_on_exception=
- run
- safe_level
- set_trace_func
- status
- stop?
- terminate
- thread_variable?
- thread_variable_get
- thread_variable_set
- thread_variables
- value
- wakeup
- Class methods
- DEBUG
- DEBUG=
- abort_on_exception
- abort_on_exception=
- current
- exclusive
- exit
- fork
- handle_interrupt
- kill
- list
- main
- new
- pass
- pending_interrupt?
- report_on_exception
- report_on_exception=
- start
- stop