diff options
author | Koichi Sasada <[email protected]> | 2020-12-19 05:52:18 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-19 05:52:18 +0900 |
commit | 80cb9165fa34185b601970da407a295a78ec9eff (patch) | |
tree | f19d3490ffb3fb4f5e68d02c0f551cf9d8fcbcc4 /ractor.c | |
parent | cee02d754d76563635c1db90d2ab6c01f8492470 (diff) |
add "copy: true" option for Ractor.make_shareable
Ractor.make_shareable(obj) tries to make obj a shareable object
by changing the attribute of obj and traversable objects from obj
(mainly freeze them).
"copy: true" option is more conservative approach by make deep
copied object and make it sharable. It doesn't affect any existing
objects.
Diffstat (limited to 'ractor.c')
-rw-r--r-- | ractor.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -2347,6 +2347,16 @@ rb_ractor_make_shareable(VALUE obj) return obj; } +VALUE +rb_ractor_make_copy_shareable(VALUE obj) +{ + VALUE copy = ractor_copy(obj); + rb_obj_traverse(copy, + make_shareable_check_shareable, + null_leave, mark_shareable); + return copy; +} + static enum obj_traverse_iterator_result shareable_p_enter(VALUE obj) { |