method
to_s
ruby 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;
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 (!target_th->first_func && target_th->first_proc) {
VALUE loc = rb_proc_location(target_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
- 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