Skip to content

Commit ab86ec6

Browse files
committed
Add missing lock in rb_intern_str
1 parent 517c106 commit ab86ec6

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

symbol.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,18 @@ rb_intern(const char *name)
836836
ID
837837
rb_intern_str(VALUE str)
838838
{
839-
VALUE sym = lookup_str_sym(str);
840-
841-
if (sym) {
842-
return SYM2ID(sym);
839+
ID id;
840+
GLOBAL_SYMBOLS_LOCKING(symbols) {
841+
VALUE sym = lookup_str_sym(str);
842+
if (sym) {
843+
id = SYM2ID(sym);
844+
}
845+
else {
846+
id = intern_str(str, 0);
847+
}
843848
}
844849

845-
return intern_str(str, 0);
850+
return id;
846851
}
847852

848853
void

0 commit comments

Comments
 (0)