Files
John Hawthorn 1f3e810694 Ractor.new: use Ractor.shareable_proc semantics for the block [Feature #22444]
Previously Ractor.new isolated the given block Proc in place
(rb_proc_isolate_bang) when the ractor's thread was set up. This
mutated the caller's Proc, and rejected every outer variable access.

Now Ractor.new duplicates the block and makes the copy shareable exactly
as Ractor.shareable_proc does, before any ractor resources are
allocated. The block may read outer variables that are never
reassigned and refer to shareable objects; writes, reassigned
variables, unshareable values and yield still raise
Ractor::IsolationError. The original Proc is left unchanged (not frozen,
not shareable), and instance variables on it no longer prevent use, as
the copy does not carry them.

Procs without an iseq (e.g. method procs) keep using rb_proc_isolate.
Tests and docs are updated accordingly.
2026-11-04 08:13:19 -07:00
..
…