aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cont.c b/cont.c
index 6e37f84707..3450593867 100644
--- a/cont.c
+++ b/cont.c
@@ -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;
}