mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
631eaa8510
commit
af2471365f
Notes:
git
2020-10-21 23:52:37 +09:00
1 changed files with 8 additions and 3 deletions
7
ractor.h
7
ractor.h
|
@ -257,7 +257,7 @@ rb_ractor_setup_belonging(VALUE obj)
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
rb_ractor_belonging(VALUE obj)
|
rb_ractor_belonging(VALUE obj)
|
||||||
{
|
{
|
||||||
if (rb_ractor_shareable_p(obj)) {
|
if (SPECIAL_CONST_P(obj) || RB_OBJ_SHAREABLE_P(obj)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -277,9 +277,14 @@ rb_ractor_confirm_belonging(VALUE obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (UNLIKELY(id != rb_ractor_current_id())) {
|
else if (UNLIKELY(id != rb_ractor_current_id())) {
|
||||||
|
if (rb_ractor_shareable_p(obj)) {
|
||||||
|
// ok
|
||||||
|
}
|
||||||
|
else {
|
||||||
rp(obj);
|
rp(obj);
|
||||||
rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id());
|
rb_bug("rb_ractor_confirm_belonging object-ractor id:%u, current-ractor id:%u", id, rb_ractor_current_id());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue