diff --git a/ChangeLog b/ChangeLog index 7b9edab302..73650af2d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Tue Oct 9 17:08:00 2001 Nobuyoshi Nakada * eval.c (rb_thread_priority_set): return the priority not but self. +Sat Oct 6 23:07:08 2001 Yukihiro Matsumoto + + * eval.c (rb_eval): NODE_MATCH3 was confusing left and right. sigh. + Fri Oct 5 15:19:46 2001 Yukihiro Matsumoto * marshal.c (w_unique): should not dump anonymous class. diff --git a/eval.c b/eval.c index 1023bbbc65..5b31d6096f 100644 --- a/eval.c +++ b/eval.c @@ -2140,11 +2140,11 @@ rb_eval(self, n) { VALUE r = rb_eval(self,node->nd_recv); VALUE l = rb_eval(self,node->nd_value); - if (TYPE(r) == T_STRING) { - result = rb_reg_match(l, r); + if (TYPE(l) == T_STRING) { + result = rb_reg_match(r, l); } else { - result = rb_funcall(r, match, 1, l); + result = rb_funcall(l, match, 1, r); } } break; @@ -8026,8 +8026,8 @@ rb_thread_run(thread) } static VALUE -rb_thread_kill(thread) - VALUE thread; +thread_kill(thread, result) + VALUE thread, result; { rb_thread_t th = rb_thread_check(thread); @@ -8041,10 +8041,18 @@ rb_thread_kill(thread) rb_thread_ready(th); th->gid = 0; th->status = THREAD_TO_KILL; + th->result = result; if (!rb_thread_critical) rb_thread_schedule(); return thread; } +static VALUE +rb_thread_kill(th) + VALUE th; +{ + return thread_kill(th, Qfalse); +} + static VALUE rb_thread_s_kill(obj, th) VALUE obj, th; @@ -8053,9 +8061,23 @@ rb_thread_s_kill(obj, th) } static VALUE -rb_thread_exit() +rb_thread_exit(argc, argv, th) + int argc; + VALUE *argv; + VALUE th; { - return rb_thread_kill(curr_thread->thread); + VALUE result = Qfalse; + + rb_scan_args(argc, argv, "01", &result); + return rb_thread_kill(th, result); +} + +static VALUE +rb_thread_s_exit(argc, argv) + int argc; + VALUE *argv; +{ + return rb_thread_exit(argc, argv, curr_thread->thread); } static VALUE @@ -8961,7 +8983,7 @@ Init_Thread() rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0); rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1); - rb_define_singleton_method(rb_cThread, "exit", rb_thread_exit, 0); + rb_define_singleton_method(rb_cThread, "exit", rb_thread_s_exit, -1); rb_define_singleton_method(rb_cThread, "pass", rb_thread_pass, 0); rb_define_singleton_method(rb_cThread, "current", rb_thread_current, 0); rb_define_singleton_method(rb_cThread, "main", rb_thread_main, 0); @@ -8976,7 +8998,7 @@ Init_Thread() rb_define_method(rb_cThread, "run", rb_thread_run, 0); rb_define_method(rb_cThread, "wakeup", rb_thread_wakeup, 0); rb_define_method(rb_cThread, "kill", rb_thread_kill, 0); - rb_define_method(rb_cThread, "exit", rb_thread_kill, 0); + rb_define_method(rb_cThread, "exit", rb_thread_exit, -1); rb_define_method(rb_cThread, "value", rb_thread_value, 0); rb_define_method(rb_cThread, "status", rb_thread_status, 0); rb_define_method(rb_cThread, "join", rb_thread_join, 0);