summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-16 09:23:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-16 09:23:33 +0000
commit0eb5a42b910728cea4d382867827f4a1b8bbb392 (patch)
tree241f87f6e415f052eafde3648cdf378efa6af31f /eval.c
parent1d3b7cfd744da2b279c2ab92517da05ad21f4adf (diff)
* eval.c (rb_proc_new): call svalue_to_avalue for yield argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 4a3850c..820b1ca 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