summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 04:55:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 04:55:10 +0000
commit485f88e62e1e00a5a49ca9054ecadfb101ad7a89 (patch)
tree634516b4f9b222f096a136cc0b6ff53484553812 /cont.c
parent854a6e47a5eeabd177f23dae121c07e36c9eab38 (diff)
* reduce UNREACHABLE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/cont.c b/cont.c
index 256ae37..97602ad 100644
--- a/cont.c
+++ b/cont.c
@@ -1093,25 +1093,22 @@ return_fiber(void)
{
rb_fiber_t *fib;
VALUE curr = rb_fiber_current();
+ VALUE prev;
GetFiberPtr(curr, fib);
- if (fib->prev == Qnil) {
- rb_thread_t *th = GET_THREAD();
+ prev = fib->prev;
+ if (NIL_P(prev)) {
+ const VALUE root_fiber = GET_THREAD()->root_fiber;
- if (th->root_fiber != curr) {
- return th->root_fiber;
- }
- else {
+ if (root_fiber == curr) {
rb_raise(rb_eFiberError, "can't yield from root fiber");
}
+ return root_fiber;
}
else {
- VALUE prev = fib->prev;
fib->prev = Qnil;
return prev;
}
-
- UNREACHABLE;
}
VALUE rb_fiber_transfer(VALUE fib, int argc, VALUE *argv);