summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-17 04:51:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-17 04:51:33 +0000
commit76fa0d6615c4d3fbfa3eddc7aab7a94bb08d827f (patch)
tree71da0b597cb5667ca31d5180533d93926b2caf2a /thread.c
parenta289f7a4b143fd227b503f85af939ecd47491167 (diff)
* thread.c: added rdocs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c50
1 files changed, 50 insertions, 0 deletions
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 <code>Thread#set_trace_func</code> 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)
{