summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-25 18:22:58 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-25 18:22:58 +0000
commitf53d8254474628f0c3710950ee342ecf941f2fd1 (patch)
treeaf5ceb44bbe0884aff93af7a64f5638e72af139d /cont.c
parent6ebdbb30add7acc3edc49bc910c4931e5125fb10 (diff)
* cont.c, vm_core.h, eval.c: because rb_protect must not be jumped by
callcc, revert r26407. And rename trap_tag to protect_tag and change exception message (across trap -> across stack rewinding barrier). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index 932b10e2dc..185d8122e4 100644
--- a/cont.c
+++ b/cont.c
@@ -388,6 +388,7 @@ cont_restore_1(rb_context_t *cont)
th->state = sth->state;
th->status = sth->status;
th->tag = sth->tag;
+ th->protect_tag = sth->protect_tag;
th->errinfo = sth->errinfo;
th->first_proc = sth->first_proc;
@@ -620,6 +621,9 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eRuntimeError, "continuation called across threads");
}
+ if (cont->saved_thread.protect_tag != th->protect_tag) {
+ rb_raise(rb_eRuntimeError, "continuation called across stack rewinding barrier");
+ }
if (cont->saved_thread.fiber) {
rb_fiber_t *fcont;
GetFiberPtr(cont->saved_thread.fiber, fcont);
@@ -936,6 +940,9 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eFiberError, "fiber called across threads");
}
+ else if (cont->saved_thread.protect_tag != th->protect_tag) {
+ rb_raise(rb_eFiberError, "fiber called across stack rewinding barrier");
+ }
else if (fib->status == TERMINATED) {
value = rb_exc_new2(rb_eFiberError, "dead fiber called");
if (th->fiber != fibval) rb_exc_raise(value);