summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-09-16 09:04:13 +0900
committerKoichi Sasada <ko1@atdot.net>2020-09-18 14:17:49 +0900
commitdd5db6f5fed359efc85cff25d326b5fc3de66614 (patch)
treefcbe09dae6d93286cb39fabeb8e2fd4ef5d2a469 /string.c
parent609e6ac0ca311fd38dbef09796dfc0102ccd4b83 (diff)
sync fstring_table for deletion
Ractors can access this table simultaneously so we need to sync accesses.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3548
Diffstat (limited to 'string.c')
-rw-r--r--string.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/string.c b/string.c
index 8de906bef5..1377ea37e4 100644
--- a/string.c
+++ b/string.c
@@ -1378,8 +1378,13 @@ rb_str_free(VALUE str)
{
if (FL_TEST(str, RSTRING_FSTR)) {
st_data_t fstr = (st_data_t)str;
- st_delete(rb_vm_fstring_table(), &fstr, NULL);
- RB_DEBUG_COUNTER_INC(obj_str_fstr);
+
+ RB_VM_LOCK_ENTER();
+ {
+ st_delete(rb_vm_fstring_table(), &fstr, NULL);
+ RB_DEBUG_COUNTER_INC(obj_str_fstr);
+ }
+ RB_VM_LOCK_LEAVE();
}
if (STR_EMBED_P(str)) {