File: C:/Ruby27-x64/share/ri/2.7.0/system/Fiber/transfer-i.ri
U:RDoc::AnyMethod[iI"
transfer:ETI"Fiber#transfer;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [
I"GTransfer control to another fiber, resuming it from where it last ;TI"Fstopped or starting it if it was not resumed before. The calling ;TI"4fiber will be suspended much like in a call to ;TI";Fiber.yield. You need to <code>require 'fiber'</code> ;TI"before using this method.;To:RDoc::Markup::BlankLine o;
; [I"GThe fiber which receives the transfer call is treats it much like ;TI"Ha resume call. Arguments passed to transfer are treated like those ;TI"passed to resume.;T@o;
; [
I"GYou cannot call +resume+ on a fiber that has been transferred to. ;TI"GIf you call +transfer+ on a fiber, and later call +resume+ on the ;TI"Kthe fiber, a +FiberError+ will be raised. Once you call +transfer+ on ;TI"@a fiber, the only way to resume processing the fiber is to ;TI"!call +transfer+ on it again.;T@o;
; [I"
Example:;T@o:RDoc::Markup::Verbatim; [I"fiber1 = Fiber.new do
;TI" puts "In Fiber 1"
;TI" Fiber.yield
;TI" puts "In Fiber 1 again"
;TI" end
;TI"
;TI"fiber2 = Fiber.new do
;TI" puts "In Fiber 2"
;TI" fiber1.transfer
;TI"% puts "Never see this message"
;TI" end
;TI"
;TI"fiber3 = Fiber.new do
;TI" puts "In Fiber 3"
;TI" end
;TI"
;TI"fiber2.resume
;TI"fiber3.resume
;TI"!fiber1.resume rescue (p $!)
;TI"fiber1.transfer
;T:@format0o;
; [I"<em>produces</em>;T@o;; [
I"In Fiber 2
;TI"In Fiber 1
;TI"In Fiber 3
;TI"4#<FiberError: cannot resume transferred Fiber>
;TI"In Fiber 1 again;T;
0:
@fileI"cont.c;T:0@omit_headings_from_table_of_contents_below0I"&fiber.transfer(args, ...) -> obj
;T0[ I"(*args);T@BFI"
Fiber;TcRDoc::NormalClass00