diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-16 09:23:33 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-16 09:23:33 +0000 |
| commit | 26ba7f21e62387c432a345a2a4ca84e5318d1ad2 (patch) | |
| tree | 241f87f6e415f052eafde3648cdf378efa6af31f | |
| parent | 5ee930add7674089af66e66c25e0182b611ce92a (diff) | |
| download | ruby-26ba7f21e62387c432a345a2a4ca84e5318d1ad2.tar.gz ruby-26ba7f21e62387c432a345a2a4ca84e5318d1ad2.tar.xz ruby-26ba7f21e62387c432a345a2a4ca84e5318d1ad2.zip | |
* 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
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | eval.c | 24 |
2 files changed, 27 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Wed Jul 16 16:23:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org> + + * eval.c (rb_proc_new): call svalue_to_avalue for yield argument. + Wed Jul 16 00:31:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org> * eval.c (rb_disable_super, rb_enable_super): deprecate. @@ -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 |
