unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Cedric Cellier <rixed@free.fr>,
Cc: bug-guile@gnu.org, guile-devel <guile-devel@gnu.org>
Subject: Re: [bug #33996] 2.0.2: Crash related to ports and threads
Date: Thu, 18 Aug 2011 11:36:37 +0200	[thread overview]
Message-ID: <871uwjhxi2.fsf@pobox.com> (raw)
In-Reply-To: <20110812-094212.sv11689.31911@savannah.gnu.org> (Cedric Cellier's message of "Fri, 12 Aug 2011 07:42:13 +0000")

Hi Cedric,

On Fri 12 Aug 2011 09:42, Cedric Cellier <INVALID.NOREPLY@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	other threads:[~2011-08-18  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12  7:42 [bug #33996] 2.0.2: Crash related to ports and threads Cedric Cellier
2011-08-18  9:36 ` Andy Wingo [this message]
2011-08-21 13:22   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871uwjhxi2.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=bug-guile@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=rixed@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).