mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: compare_by_id
* thread.c (recursive_list_access): let symbol only hashes compare the elements by id. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
378d20f80d
commit
c7572f2fe7
1 changed files with 12 additions and 2 deletions
14
thread.c
14
thread.c
|
@ -4738,6 +4738,16 @@ rb_thread_shield_destroy(VALUE self)
|
|||
/* variables for recursive traversals */
|
||||
static ID recursive_key;
|
||||
|
||||
extern const struct st_hash_type st_hashtype_num;
|
||||
|
||||
static VALUE
|
||||
ident_hash_new(void)
|
||||
{
|
||||
VALUE hash = rb_hash_new();
|
||||
rb_hash_tbl_raw(hash)->type = &st_hashtype_num;
|
||||
return hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the current "recursive list" used to detect recursion.
|
||||
* This list is a hash table, unique for the current thread and for
|
||||
|
@ -4751,7 +4761,7 @@ recursive_list_access(void)
|
|||
VALUE sym = ID2SYM(rb_frame_this_func());
|
||||
VALUE list;
|
||||
if (NIL_P(hash) || !RB_TYPE_P(hash, T_HASH)) {
|
||||
hash = rb_hash_new();
|
||||
hash = ident_hash_new();
|
||||
rb_thread_local_aset(rb_thread_current(), recursive_key, hash);
|
||||
list = Qnil;
|
||||
}
|
||||
|
@ -4759,7 +4769,7 @@ recursive_list_access(void)
|
|||
list = rb_hash_aref(hash, sym);
|
||||
}
|
||||
if (NIL_P(list) || !RB_TYPE_P(list, T_HASH)) {
|
||||
list = rb_hash_new();
|
||||
list = ident_hash_new();
|
||||
rb_hash_aset(hash, sym, list);
|
||||
}
|
||||
return list;
|
||||
|
|
Loading…
Reference in a new issue