summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-11 06:29:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-11 06:29:16 +0000
commit6c11709d4c2ca083d0c1f7c7041b5aec4efd9361 (patch)
tree5b16a6e87ee2915c89357e9f15b3d0b1a21b8d93 /eval.c
parenta86f6a00df5c97e1e6c64d96e39e11e2df3d9053 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/eval.c b/eval.c
index 03f822a..9f511cf 100644
--- a/eval.c
+++ b/eval.c
@@ -7723,7 +7723,7 @@ catch_timer(sig)
int rb_thread_tick = THREAD_TICK;
#endif
-static VALUE rb_thread_raise _((int, VALUE*, VALUE));
+static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
#define SCOPE_SHARED FL_USER1
@@ -7806,13 +7806,13 @@ rb_thread_start_0(fn, arg, th)
}
else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
/* delegate exception to main_thread */
- rb_thread_raise(1, &ruby_errinfo, main_thread->thread);
+ rb_thread_raise(1, &ruby_errinfo, main_thread);
}
else if (thread_abort || th->abort || RTEST(ruby_debug)) {
VALUE err = rb_exc_new(rb_eSystemExit, 0, 0);
error_print();
/* exit on main_thread */
- rb_thread_raise(1, &err, main_thread->thread);
+ rb_thread_raise(1, &err, main_thread);
}
else {
th->errinfo = ruby_errinfo;
@@ -7948,7 +7948,7 @@ rb_thread_cleanup()
{
rb_thread_t th;
- if (curr_thread != curr_thread->next->prev) {
+ while (curr_thread->status == THREAD_KILLED) {
curr_thread = curr_thread->prev;
}
@@ -8049,23 +8049,18 @@ rb_thread_trap_eval(cmd, sig)
}
static VALUE
-rb_thread_raise(argc, argv, thread)
+rb_thread_raise(argc, argv, th)
int argc;
VALUE *argv;
- VALUE thread;
+ rb_thread_t th;
{
- rb_thread_t th = rb_thread_check(thread);
-
if (rb_thread_dead(th)) return Qnil;
if (curr_thread == th) {
rb_f_raise(argc, argv);
}
- if (ruby_safe_level > th->safe) {
- rb_secure(4);
- }
if (THREAD_SAVE_CONTEXT(curr_thread)) {
- return thread;
+ return th->thread;
}
rb_scan_args(argc, argv, "11", &th_raise_argv[0], &th_raise_argv[1]);
@@ -8079,6 +8074,20 @@ rb_thread_raise(argc, argv, thread)
return Qnil; /* not reached */
}
+static VALUE
+rb_thread_raise_m(argc, argv, thread)
+ int argc;
+ VALUE *argv;
+ VALUE thread;
+{
+ rb_thread_t th = rb_thread_check(thread);
+
+ if (ruby_safe_level > th->safe) {
+ rb_secure(4);
+ }
+ rb_thread_raise(argc, argv, th);
+}
+
VALUE
rb_thread_local_aref(thread, id)
VALUE thread;
@@ -8332,7 +8341,7 @@ Init_Thread()
rb_define_method(rb_cThread, "join", rb_thread_join, 0);
rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
- rb_define_method(rb_cThread, "raise", rb_thread_raise, -1);
+ rb_define_method(rb_cThread, "raise", rb_thread_raise_m, -1);
rb_define_method(rb_cThread, "abort_on_exception", rb_thread_abort_exc, 0);
rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);