diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-10-30 00:32:53 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-10-30 03:12:09 +0900 |
commit | 5d97bdc2dcb835c877010daa033cc2b1dfeb86d6 (patch) | |
tree | 147bbd2e687a9db2bbd5fede670690eae644ebe1 /vm_core.h | |
parent | 502d6d845946f367ffb6e972e9c4ac401da94e99 (diff) |
Ractor.make_shareable(a_proc)
Ractor.make_shareable() supports Proc object if
(1) a Proc only read outer local variables (no assignments)
(2) read outer local variables are shareable.
Read local variables are stored in a snapshot, so after making
shareable Proc, any assignments are not affeect like that:
```ruby
a = 1
pr = Ractor.make_shareable(Proc.new{p a})
pr.call #=> 1
a = 2
pr.call #=> 1 # `a = 2` doesn't affect
```
[Feature #17284]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3722
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1065,6 +1065,7 @@ typedef struct { VALUE rb_proc_isolate(VALUE self); VALUE rb_proc_isolate_bang(VALUE self); +VALUE rb_proc_ractor_make_shareable(VALUE self); typedef struct { VALUE flags; /* imemo header */ |