method
to_s
v2_6_3 -
Show latest stable
- Class:
Thread
to_s()public
Dump the name, id, and status of thr to a string.
static VALUE
rb_thread_to_s(VALUE thread)
{
VALUE cname = rb_class_path(rb_obj_class(thread));
rb_thread_t *target_th = rb_thread_ptr(thread);
const char *status;
VALUE str, loc;
status = thread_status_name(target_th, TRUE);
str = rb_sprintf("#<%"PRIsVALUE":%p", cname, (void *)thread);
if (!NIL_P(target_th->name)) {
rb_str_catf(str, "@%"PRIsVALUE, target_th->name);
}
if ((loc = threadptr_invoke_proc_location(target_th)) != Qnil) {
rb_str_catf(str, "@%"PRIsVALUE":%"PRIsVALUE,
RARRAY_AREF(loc, 0), RARRAY_AREF(loc, 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
- fetch
- 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
- to_s
- 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