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 | eaf74a2060dd53de038f9a665f5f5e77c1f65363 (patch) | |
tree | 8f1e89f4b9634c665102ae5a745f4af38802bc3b /cont.c | |
parent | fa304810e15a8c66f787561a472de02ee0ca9002 (diff) | |
download | ruby-eaf74a2060dd53de038f9a665f5f5e77c1f65363.tar.gz ruby-eaf74a2060dd53de038f9a665f5f5e77c1f65363.tar.xz ruby-eaf74a2060dd53de038f9a665f5f5e77c1f65363.zip |
* cont.c (rb_cont_call): forbid cross fiber continuation call.
* test/ruby/test_fiber.rb: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/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; } |