[ruby-dev:50723] [Ruby trunk Bug#595] Fiber ignores ensure clause
From:
samuel@...
Date:
2018-12-20 04:19:21 UTC
List:
ruby-dev #50723
Issue #595 has been updated by ioquatix (Samuel Williams).
Target version set to next minor
After discussion, we decided that:
- Doing this in the GC is probably a bad idea.
- Ruby's general model for resource management is explicit, e.g. `f =3D Fil=
e.open; f.close` or `File.open do |f| ... end`. The same model should apply=
to Fiber.
- We can implement something like `Fiber.kill` or `Fiber.close` which essen=
tially invokes `Fiber.raise(Exception)` until the Fiber is dead.
We will test these ideas during 2.7 release. If there are any further thoug=
hts about this approach, please feel free to add them here.
----------------------------------------
Bug #595: Fiber ignores ensure clause
https://bugs.ruby-lang.org/issues/595#change-75793
* Author: ko1 (Koichi Sasada)
* Status: Assigned
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: next minor
* ruby -v: -
* Backport:=20
----------------------------------------
Ruby =E3=83=97=E3=83=AD=E3=82=BB=E3=82=B9=E7=B5=82=E4=BA=86=E6=99=82=EF=BC=
=8CFiber =E3=81=8C ensure =E3=82=92=E7=84=A1=E8=A6=96=E3=81=97=E3=81=BE=E3=
=81=99=EF=BC=8E
=E3=81=93=E3=82=8C=E3=81=AF=EF=BC=8C=E5=89=8D=E3=81=8B=E3=82=89=E7=9B=B4=
=E3=81=9D=E3=81=86=E3=81=A8=E6=80=9D=E3=81=A3=E3=81=A6=E6=89=8B=E3=81=8C=E3=
=81=A4=E3=81=84=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E5=95=
=8F=E9=A1=8C=E3=81=A7=E3=81=99=EF=BC=8E
10=E6=9C=88=E6=9C=AB=E3=81=BE=E3=81=A7=E3=81=AB=E3=81=AF=E7=9B=B4=E3=81=9D=
=E3=81=86=E3=81=A8=E6=80=9D=E3=81=84=E3=81=BE=E3=81=99=EF=BC=8E=E7=B5=90=E6=
=A7=8B=E8=A4=87=E9=9B=91=E3=81=AA=E3=81=AE=E3=81=A7=EF=BC=8C=E5=BE=8C=E5=9B=
=9E=E3=81=97=E3=81=AB=E3=81=97=E3=81=A6=E3=81=84=E3=81=BE=E3=81=97=E3=81=BE=
=E3=81=97=E3=81=9F=EF=BC=8E
```=20
fib =3D Fiber.new{
begin
Fiber.yield :ok
ensure
puts "should be print out"
end
}
p fib.resume
```
---Files--------------------------------
ensure_fiber.patch (2.12 KB)
ensure_fiber2.patch (7.57 KB)
--=20
https://bugs.ruby-lang.org/