aboutsummaryrefslogtreecommitdiffstats
path: root/vm_method.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-09-25 18:31:04 +0900
committerKoichi Sasada <ko1@atdot.net>2020-09-25 20:37:38 +0900
commitcaaa36b4e6d0d59f0aa21049c063b140aa5aae4f (patch)
tree51e95c8e7be7a1a1793ab02a4c9f3a2cf2e1867f /vm_method.c
parent890bc2cdde4097390f3b71dfeaa36dd92ee0afe2 (diff)
downloadruby-caaa36b4e6d0d59f0aa21049c063b140aa5aae4f.tar.gz
prohibi method call by defined_method in other racotrs
We can not call a non-isolated Proc in multiple ractors.
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c
index 0428ae6380..de48dc65a2 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -430,6 +430,7 @@ rb_method_definition_set(const rb_method_entry_t *me, rb_method_definition_t *de
}
case VM_METHOD_TYPE_BMETHOD:
RB_OBJ_WRITE(me, &def->body.bmethod.proc, (VALUE)opts);
+ RB_OBJ_WRITE(me, &def->body.bmethod.defined_ractor, GET_THREAD()->ractor->self);
return;
case VM_METHOD_TYPE_NOTIMPLEMENTED:
setup_method_cfunc_struct(UNALIGNED_MEMBER_PTR(def, body.cfunc), rb_f_notimplement, -1);
@@ -471,6 +472,7 @@ method_definition_reset(const rb_method_entry_t *me)
break;
case VM_METHOD_TYPE_BMETHOD:
RB_OBJ_WRITTEN(me, Qundef, def->body.bmethod.proc);
+ RB_OBJ_WRITTEN(me, Qundef, def->body.bmethod.defined_ractor);
/* give up to check all in a list */
if (def->body.bmethod.hooks) rb_gc_writebarrier_remember((VALUE)me);
break;