diff --git a/ChangeLog b/ChangeLog index 66d256bdd6..6c6c9bb7be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jul 16 16:23:58 2003 Yukihiro Matsumoto + + * eval.c (rb_proc_new): call svalue_to_avalue for yield argument. + Wed Jul 16 00:31:00 2003 Yukihiro Matsumoto * eval.c (rb_disable_super, rb_enable_super): deprecate. diff --git a/eval.c b/eval.c index 4a3850c0e6..820b1ca5c4 100644 --- a/eval.c +++ b/eval.c @@ -7553,12 +7553,29 @@ bmcall(args, method) return method_call(RARRAY(a)->len, RARRAY(a)->ptr, method); } +struct proc_funcall_data { + VALUE (*func)(ANYARGS); + VALUE val; +}; + +static VALUE +proc_funcall(args, data) + VALUE args; + struct proc_funcall_data *data; +{ + return (*data->func)(svalue_to_avalue(args), data->val); +} + VALUE rb_proc_new(func, val) VALUE (*func)(ANYARGS); /* VALUE yieldarg[, VALUE procarg] */ VALUE val; { - return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val); + struct proc_funcall_data data; + + data.func = func; + data.val = val; + return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, proc_funcall, (VALUE)&data); } static VALUE @@ -9256,6 +9273,11 @@ rb_thread_start_0(fn, arg, th_arg) enum thread_status status; int state; + if (OBJ_FROZEN(curr_thread->thgroup)) { + rb_raise(rb_eThreadError, + "can't start a new thread (frozen ThreadGroup)"); + } + #if defined(HAVE_SETITIMER) if (!thread_init) { #ifdef POSIX_SIGNAL