Issue #595 has been updated by wanabe (_ wanabe).

File ensure_fiber2.patch added

???????????????????

(1) GC ??? mark ??? sweep ????????mark ?????????????? Fiber ???対象???
(2) ruby_cleanup 中????????????????????????????????? Fiber ???対象???
(3) ???????????????vm->living_threads ?????????????????????????????????????????? Fiber ???対象???
??? 3 ?????????????throw/catch ??????? ensure ??????????????????????????????????????

[ruby-dev:41035] ??????????????????????????????????????????yield 中?? Fiber ??? GC ??????????
??????????????????????????????????test/ruby/test_fiber.rb ????????????????????????????????
Fiber ???????????????????? Fiber ???????????費???????????????念?????????????
????????????(1)???????????rb_gc_marked_p() ??????????????????????強?????段??使???????????

???????以?????????????????度????????????????????

require "benchmark"
GC.start
Benchmark.bm(4) do |x|
  tms = Benchmark::Tms.new
  10.times do |i|
    tms += x.report("   #{i}:") do
      30000.times do
        Fiber.new{Fiber.yield}.resume
      end
    end
  end
  puts " sum:#{tms}"
end

???? r36623 ?2.980000   3.120000   6.100000 (  6.107164)
???????????????3.580000   3.480000   7.060000 (  7.061093)

?????????????????度???? 14%????度????????????????????????
??????????????以??????????????????????????????????????????????????????????
----------------------------------------
Bug #595: Fiber ignores ensure clause
https://bugs.ruby-lang.org/issues/595#change-28655

Author: ko1 (Koichi Sasada)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 3.0
ruby -v: -


=begin
 Ruby ??????????????Fiber ??? ensure ???????????????
 ??????????????????????????????????????????????????????????????
 10??????????????????????????????????????????????????????????????????
 
 fib = Fiber.new{
   begin
     Fiber.yield :ok
   ensure
     puts "should be print out"
   end
 }
 p fib.resume
=end



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