Feature #22441
Updated by jhawthorn (John Hawthorn) 1 day ago
I propose adding `Ractor#alive?` as a non-blocking way to ask whether a Ractor has finished. This matches `Thread#alive?`/`Fiber#alive?`.
```
r = Ractor.new { Ractor.receive }
r.alive? #=> true
r << :done
r.join
r.alive? #=> false
```
This is already somewhat visible via `Ractor#inspect`, but that's quite awkward. We use this in the test suite.
```
r = Ractor.new{ sleep 1 }
r.inspect #=> "#<Ractor:#3 (irb):4 running>"
sleep 2
r.inspect #=> "#<Ractor:#3 (irb):4 terminated>"
```
After fork, other Ractors `alive?` will return false, as with `Thread#alive?`.
https://github.com/ruby/ruby/pull/19349