From 26ba7f21e62387c432a345a2a4ca84e5318d1ad2 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 16 Jul 2003 09:23:33 +0000 Subject: * eval.c (rb_proc_new): call svalue_to_avalue for yield argument. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 4a3850c0e..820b1ca5c 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 -- cgit