static void rb_fiber_terminate(rb_fiber_t *fib) { VALUE value = fib->cont.value; fib->status = TERMINATED; rb_fiber_transfer(return_fiber(), 1, &value); }
static void rb_fiber_terminate(rb_context_t *cont) { VALUE value = cont->value; cont->alive = Qfalse; rb_fiber_transfer(return_fiber(), 1, &value); }
/* * call-seq: * fiber.transfer(args, ...) -> obj * * Transfer control to another fiber, resuming it from where it last * stopped or starting it if it was not resumed before. The calling * fiber will be suspended much like in a call to <code>Fiber.yield</code>. * * The fiber which recieves the transfer call is treats it much like * a resume call. Arguments passed to transfer are treated like those * passed to resume. * * You cannot resume a fiber that transferred control to another one. * This will cause a double resume error. You need to transfer control * back to this fiber before it can yield and resume. */ static VALUE rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fib) { return rb_fiber_transfer(fib, argc, argv); }
VALUE rb_fiber_yield(int argc, VALUE *argv) { return rb_fiber_transfer(return_fiber(), argc, argv); }