From 76fa0d6615c4d3fbfa3eddc7aab7a94bb08d827f Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 17 Sep 2009 04:51:33 +0000 Subject: * thread.c: added rdocs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/thread.c b/thread.c index 984227ea81..caa9913374 100644 --- a/thread.c +++ b/thread.c @@ -143,12 +143,28 @@ void rb_thread_debug(const char *fmt, ...); # if THREAD_DEBUG < 0 static int rb_thread_debug_enabled; +/* + * call-seq: + * Thread.DEBUG => num + * + * Returns the thread debug level. Available only if compiled with + * THREAD_DEBUG=-1. + */ + static VALUE rb_thread_s_debug(void) { return INT2NUM(rb_thread_debug_enabled); } +/* + * call-seq: + * Thread.DEBUG = num + * + * Sets the thread debug level. Available only if compiled with + * THREAD_DEBUG=-1. + */ + static VALUE rb_thread_s_debug_set(VALUE self, VALUE val) { @@ -503,6 +519,7 @@ thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS)) return thval; } +/* :nodoc: */ static VALUE thread_s_new(int argc, VALUE *argv, VALUE klass) { @@ -533,6 +550,7 @@ thread_start(VALUE klass, VALUE args) return thread_create_core(rb_thread_alloc(klass), args, 0); } +/* :nodoc: */ static VALUE thread_initialize(VALUE thread, VALUE args) { @@ -1634,6 +1652,13 @@ rb_thread_main(void) return GET_THREAD()->vm->main_thread->self; } +/* + * call-seq: + * Thread.main => thread + * + * Returns the main thread. + */ + static VALUE rb_thread_s_main(VALUE klass) { @@ -3852,6 +3877,14 @@ thread_add_trace_func(rb_thread_t *th, VALUE trace) rb_threadptr_add_event_hook(th, call_trace_func, RUBY_EVENT_ALL, trace); } +/* + * call-seq: + * thr.add_trace_func(proc) => proc + * + * Adds _proc_ as a handler for tracing. + * See Thread#set_trace_func and +set_trace_func+. + */ + static VALUE thread_add_trace_func_m(VALUE obj, VALUE trace) { @@ -3861,6 +3894,16 @@ thread_add_trace_func_m(VALUE obj, VALUE trace) return trace; } +/* + * call-seq: + * thr.set_trace_func(proc) => proc + * thr.set_trace_func(nil) => nil + * + * Establishes _proc_ on _thr_ as the handler for tracing, or + * disables tracing if the parameter is +nil+. + * See +set_trace_func+. + */ + static VALUE thread_set_trace_func_m(VALUE obj, VALUE trace) { @@ -4000,6 +4043,13 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always) VALUE rb_thread_backtrace(VALUE thval); +/* + * call-seq: + * thr.backtrace => array + * + * Returns the current back trace of the _thr_. + */ + static VALUE rb_thread_backtrace_m(VALUE thval) { -- cgit v1.2.3