Issue #12555 has been updated by ko1 (Koichi Sasada).

Status changed from Closed to Rejected

see https://bugs.ruby-lang.org/issues/9664#note-6

----------------------------------------
Bug #12555: Cannot resume a fiber that was earlier transferred from, then transferred back to, and then yielded
https://bugs.ruby-lang.org/issues/12555#change-82305

* Author: amukher1 (Arindam Mukherjee)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.3.0
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Consider the following code snippet:

~~~
require 'fiber'

fiber2 = nil

fiber1 = Fiber.new do
  puts "In Fiber 1"                 # 3
  fiber2.transfer                   # 4
end

fiber2 = Fiber.new do
  puts "In Fiber 2"                  # 1
  fiber1.transfer                    # 2
  puts "In Fiber 2 again"            # 5
  Fiber.yield                        # 6
  puts "Fiber 2 resumed"             # 10
end

fiber3 = Fiber.new do
  puts "In Fiber 3"                  # 8
end

fiber2.resume                        # 0
fiber3.resume                        # 7
fiber2.resume                        # 9
~~~

I have numbered the lines of code with the expected serial order of execution on the right. Once `fiber3.resume` returns and I call `fiber2.resume`, I expect the execution to continue inside `fiber2` at the line marked # 10. Instead, I get the following error:

~~~
fiber2.rb:24:in `resume': cannot resume transferred Fiber (FiberError)
    from fiber2.rb:24:in `<main>'
~~~

That's an error reported from the last line of the listing: `fiber2.resume`.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>