[Ecls-list] Hopefully some innovation..

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Mon Jan 7 20:45:17 UTC 2008


On Jan 7, 2008 2:57 PM, Erik Huelsmann <ehuels at gmail.com> wrote:
> SBCL has recently grown hashes which allow thread-safe reading and
> writing without requiring locks

I have skimmed the changelog of SBCL:

changes in sbcl-1.0.11 relative to sbcl-1.0.10:
  * incompatible change: hash-table accessor functions are no longer
    automatically protected by locks. Concurrent accesses on the same hash-table
    from multiple threads can give inconsistent results or even corrupt the
    hash-table completely. Multi-threaded applications should do their own
    locking at the correct granularity.

This means SBCL's hash tables are by default unsafe under threading.
Later on they added...

changes in sbcl-1.0.12 relative to sbcl-1.0.11:
  * new feature: MAKE-HASH-TABLE now experimentally accepts a
    :SYNCHRONIZED argument, which makes the hash-table safe for
    concurrent accesses (but not iteration.) See also:
    SB-EXT:WITH-LOCKED-HASH-TABLE, and
    SB-EXT:HASH-TABLE-SYNCHRONIZED-P.

I had a look at WITH-LOCKED-HASH-TABLE and it uses a spin-lock which
is stored in the hash table. So basically they behave similarly as in
ECL. Iteration is not safe in the sense that the hash table may change
while being traversed, but data will definitely not get corrupt.

Juanjo

-- 
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list