Hi Cedric,

On Fri 12 Aug 2011 09:42, Cedric Cellier <invalid.nore...@gnu.org> writes:

> (use-modules (ice-9 threads))
>
> (define (forever f)
>   (f)
>   (forever f))
>
> ; Spawn a thread that performs some writes
> (make-thread forever (lambda ()
>                        (display "write...\n")))
>
> (forever (lambda () (display "new pipe...\n")))

Oh dear, this is a nasty one.  The issue is that Guile's ports are not
threadsafe.  I hadn't thought about this one...

I am adding guile-devel to the Cc for input.  Any fix to this will be
pretty big, I think.  I think that the right fix here is probably what
Glibc does; see `info libc "Streams and Threads"` for the full details.

Basically they add a lock to each FILE*, which is probably what we
should do with our ports.  We could investigate Java's biased locking,
if that's useful.

Andy
-- 
http://wingolog.org/

Reply via email to