diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-10-21 22:56:35 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-10-21 23:52:11 +0900 |
commit | af2471365fedaf89759eb00f87164fbaa0afaa39 (patch) | |
tree | 23797a14f85de16bc35adae9361e741db4ffaf5f | |
parent | 631eaa85109e4d6fa31eaeed393858e1e63300a4 (diff) | |
download | ruby-af2471365fedaf89759eb00f87164fbaa0afaa39.tar.gz |
refactoring rb_ractor_confirm_belonging()
rb_ractor_belonging() returns 0 only if it has sharable flag.
rb_ractor_confirm_belonging() checks rb_ractor_shareable_p()
if the belonging ractor id is different from current ractor id.
-rw-r--r-- | ractor.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -257,7 +257,7 @@ rb_ractor_setup_belonging(VALUE obj) static inline uint32_t rb_ractor_belonging(VALUE obj) { - if (rb_ractor_shareable_p(obj)) { + if (SPECIAL_CONST_P(obj) || RB_OBJ_SHAREABLE_P(obj)) { return 0; } else { @@ -277,8 +277,13 @@ rb_ractor_confirm_belonging(VALUE obj) } } else if (UNLIKELY(id != rb_ractor_current_id())) { - rp(obj); - rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id()); + if (rb_ractor_shareable_p(obj)) { + // ok + } + else { + rp(obj); + rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id()); + } } return obj; } |