From: Peter Zotov Date: 2012-05-15T05:32:16+09:00 Subject: Re: [C exten] Is it safe to use rb_hash_delete() without having the GVL? Iñaki Baz Castillo писал 14.05.2012 04:32: > 2012/5/14 SASADA Koichi : >> I believe it is dangerous. >> >> Because: >> >> (1) rb_hash_delete() can call Ruby's #hash method for each elements. >> (2) If another thread access to the hash simultaneously, it will be >> crash. > > Thanks, I understand. However in my case I use Fixnums as keys in the > hash. I've done several tests and never crashes, maybe because Fixnum > objects are "untouchable"? Fixnum instances are immutable and calling #hash should be safe on them. However, point 2) stands: if two threads will access the hash simultaneously, that may and will lead to crashes. -- WBR, Peter Zotov.