[Ecls-list] Hopefully some innovation..

Anton Vodonosov avodonosov at yandex.ru
Mon Jan 7 22:02:36 UTC 2008


"Juan Jose Garcia-Ripoll" <jjgarcia at users.sourceforge.net> writes:

> 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

Maybe Erik means this:
http://random-state.net/log/3392121845.html


Best regards,
-Anton




More information about the ecl-devel mailing list