aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
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 cb934f79bc..34cc170334 100644
--- a/cont.c
+++ b/cont.c
@@ -1260,6 +1260,13 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
GetFiberPtr(fibval, fib);
cont = &fib->cont;
+ if (th->fiber == fibval) {
+ /* ignore fiber context switch
+ * because destination fiber is same as current fiber
+ */
+ return make_passing_arg(argc, argv);
+ }
+
if (cont->saved_thread.self != th->self) {
rb_raise(rb_eFiberError, "fiber called across threads");
}