diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-15 03:20:13 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-15 03:20:13 +0000 |
commit | 31ac946975a8e20157e1f47d23546ae237484024 (patch) | |
tree | 8f1e89f4b9634c665102ae5a745f4af38802bc3b /cont.c | |
parent | f84c8cb19079cbfe2b5433a7b3e1eca4eae3ef22 (diff) | |
download | ruby-31ac946975a8e20157e1f47d23546ae237484024.tar.gz |
* cont.c (rb_cont_call): forbid cross fiber continuation call.
* test/ruby/test_fiber.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -439,6 +439,10 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) rb_context_t *fcont; GetContPtr(cont->saved_thread.fiber, fcont); + if (th->fiber != cont->saved_thread.fiber) { + rb_raise(rb_eRuntimeError, "continuation called across fiber"); + } + if (!fcont->alive) { rb_raise(rb_eRuntimeError, "continuation called dead fiber"); } @@ -610,7 +614,7 @@ rb_fiber_yield(int argc, VALUE *argv, VALUE fval) cont_restore_0(cont, (VALUE *)&cont); rb_bug("rb_fiber_yield: unreachable"); } - + return value; } |