summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/eval.c b/eval.c
index 275e59b..bc928bb 100644
--- a/eval.c
+++ b/eval.c
@@ -5463,22 +5463,15 @@ thread_pass()
}
static VALUE
-thread_stop_method(thread)
- VALUE thread;
+thread_stop()
{
- thread_t th = thread_check(thread);
-
thread_critical = 0;
- th->status = THREAD_STOPPED;
+ curr_thread->status = THREAD_STOPPED;
+ if (curr_thread == curr_thread->next) {
+ Raise(eThreadError, "stopping only thread");
+ }
thread_schedule();
- return thread;
-}
-
-static VALUE
-thread_stop()
-{
- thread_stop_method(curr_thread->thread);
return Qnil;
}
@@ -5887,7 +5880,6 @@ Init_Thread()
rb_define_method(cThread, "run", thread_run, 0);
rb_define_method(cThread, "wakeup", thread_wakeup, 0);
- rb_define_method(cThread, "stop", thread_stop_method, 0);
rb_define_method(cThread, "exit", thread_kill, 0);
rb_define_method(cThread, "value", thread_value, 0);
rb_define_method(cThread, "status", thread_status, 0);