Project

General

Profile

Bug #6343 ยป Added-documentation-for-fiber-transfer.patch

andhapp (Anuj Dutta), 04/23/2012 02:40 PM

View differences:

cont.c
* 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.
*
* Example:
*
* fiber1 = Fiber.new do
* puts "In Fiber 1"
* Fiber.yield
* end
*
* fiber2 = Fiber.new do
* puts "In Fiber 2"
* fiber1.transfer
* end
*
* fiber3 = Fiber.new do
* puts "In Fiber 3"
* end
*
* fiber2.resume
* fiber3.resume
*
* <em>produces</em>
*
* I am in fiber2
* I am in fiber1
* I am in fiber3
*
*/
static VALUE
rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fibval)
    (1-1/1)