summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-12-09 03:58:44 +0900
committerKoichi Sasada <ko1@atdot.net>2021-12-09 16:20:04 +0900
commitcce331272b07636d536c8227288ab3fbcf24e2aa (patch)
tree167882704bfd85c0573b46c2007116a503b8c153 /vm.c
parentc5f68a9a24c4e25f551108bda4738b1000d7b197 (diff)
`Ractor.make_shareable` checks proc's sefl
`Ractor.make_shareable(proc_obj)` raises an `IsolationError` if the self of `proc_obj` is not a shareable object. [Bug #18243]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5232
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index ad687d579a..73d6cd9d5d 100644
--- a/vm.c
+++ b/vm.c
@@ -1181,6 +1181,10 @@ rb_proc_ractor_make_shareable(VALUE self)
rb_proc_t *proc = (rb_proc_t *)RTYPEDDATA_DATA(self);
if (proc->block.type != block_type_iseq) rb_raise(rb_eRuntimeError, "not supported yet");
+ if (!rb_ractor_shareable_p(vm_block_self(&proc->block))) {
+ rb_raise(rb_eRactorIsolationError, "Proc's self is not shareable");
+ }
+
VALUE read_only_variables = Qfalse;
if (iseq->body->outer_variables) {