From: Sam S. <sd...@gn...> - 2010-02-18 21:59:46
|
Vladimir Tzankov wrote: > On 2/18/10, Sam Steingold <sd...@gn...> wrote: >> On a different note: maybe make-hash-table should accept a :shared argument >> which would then add a mutex slot to it. >> Then all destructive HT operations on such a table would check for this slot >> and make sure that it has been locked. >> (is mutex_lock on an already locked mutex expensive?) >> e.g.: >> (with-lock (ht) >> (incf (gethash x ht 0))) > > Recursive mutexes are cheap. in that case this :SYNC arg to make-hash-table looks reasonable. > Current hash table implementation may need locking mutex on > non-destructive lookups in order to guard against internal state > changes that may cause segfaults (I am not 100% sure - will check it). yes. |