[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using define in multiple threads?
From: |
Ludovic Courtès |
Subject: |
Re: Using define in multiple threads? |
Date: |
Tue, 18 Nov 2008 11:20:41 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Andy Wingo <address@hidden> writes:
> On Mon 17 Nov 2008 15:57, address@hidden (Ludovic Courtès) writes:
>> Besides, as Linas noted, the hash table implementation isn't
>> thread-safe, which makes it "unsafe" to `define' in parallel.
>
> Ah, this is why, then. I was baffled.
>
> IMO this is a bug; Guile can claim that "wierd behavior is expected"
> when using a data structure from multiple threads in without locking,
> but in this case the data structure is only being used implicitly.
> Modules should contain a lock that is taken when they are mutated.
Right.
I submitted a bug: https://savannah.gnu.org/bugs/index.php?24867 . I'm
not sure whether this can easily be fixed in 1.8, since that would
require adding a mutex to `module-type' and access it from C, which
would break the ABI. Ideas?
> This isn't the first time I've wanted a functional hash table
> implementation...
I wrote long ago an implementation of functional FIFOs and one of
Bagwell's "VLists" [0]; VLists can be used at a building block for "hash
lists", which is a functional data structure akin to hash tables [0].
I've been willing to polish it and push it into Guile for some time, so
if you're motivated, that's even more motivating. :-)
Thanks,
Ludo'.
[0] http://en.wikipedia.org/wiki/VList