summaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-06 01:55:09 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-06 01:55:09 +0000
commit1d04ac82be9602ccdf7803e37b7d9b5927411043 (patch)
tree98704c08301f5b36eee8d1ef2d3896ca166b7627 /cont.c
parent7c408497ab223ea94ad45addf5ab70897fb156f5 (diff)
downloadruby-1d04ac82be9602ccdf7803e37b7d9b5927411043.tar.gz
ruby-1d04ac82be9602ccdf7803e37b7d9b5927411043.tar.xz
ruby-1d04ac82be9602ccdf7803e37b7d9b5927411043.zip
* cont.c (rb_cont_call): forbid calling dead fiber with
Cotinuation#call. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index 265e743a9..367d03375 100644
--- a/cont.c
+++ b/cont.c
@@ -344,6 +344,14 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
if (cont->saved_thread.trap_tag != th->trap_tag) {
rb_raise(rb_eRuntimeError, "continuation called across trap");
}
+ if (cont->saved_thread.fiber) {
+ rb_context_t *fcont;
+ GetContPtr(cont->saved_thread.fiber, fcont);
+
+ if (!fcont->alive) {
+ rb_raise(rb_eRuntimeError, "continuation called dead fiber");
+ }
+ }
cont->value = make_passing_arg(argc, argv);