method
inspect
v1_8_6_287 -
Show latest stable
- Class:
Thread
inspect()public
Dump the name, id, and status of thr to a string.
/*
* call-seq:
* thr.inspect => string
*
* Dump the name, id, and status of _thr_ to a string.
*/
static VALUE
rb_thread_inspect(thread)
VALUE thread;
{
char *cname = rb_obj_classname(thread);
rb_thread_t th = rb_thread_check(thread);
const char *status = thread_status_name(th->status);
VALUE str;
size_t len = strlen(cname)+7+16+9+1;
str = rb_str_new(0, len); /* 7:tags 16:addr 9:status 1:nul */
snprintf(RSTRING(str)->ptr, len, "#<%s:0x%lx %s>", cname, thread, status);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
OBJ_INFECT(str, thread);
return str;
} Related methods
- Instance methods
- []
- []=
- abort_on_exception
- abort_on_exception=
- alive?
- exit
- exit!
- group
- inspect
- join
- key?
- keys
- kill
- kill!
- priority
- priority=
- raise
- run
- safe_level
- status
- stop?
- terminate
- terminate!
- value
- wakeup
- Class methods
- abort_on_exception
- abort_on_exception=
- critical
- critical=
- current
- exclusive
- exit
- fork
- kill
- list
- main
- new
- new
- pass
- start
- stop