guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads


From: Gary Houston
Subject: Re: Threads
Date: 29 Sep 2001 21:13:35 -0000

> From: Manuel Giraud <address@hidden>
> Date: 28 Sep 2001 11:26:17 +0200
> 
> Rob Browning <address@hidden> writes:
> 
> > Manuel Giraud <address@hidden> writes:
> > 
> > > ;;; Client
> > > ;;; The message : a s-expression.
> > > (define message '(display "hello\n"))
> > 
> > > ;;; Connect and send
> > > (connect sock AF_INET (car (hostent:addr-list (gethost sname))) port)
> > > (write message sock)
> > 
> > Among other things, you may need a (force-output sock) here.
> > Otherwise the output may never get flushed to the other side, and so
> > read will never return.
> > 
> > Hope this helps.
> > 
> 
> I add this line to the client but it don't seems to solve my
> problem. In fact, everything works if I don't evaluate the client's
> message in a new thread on the server. But if, I start a new thread
> everything is locked.

force-output isn't needed, since socket ports are unbuffered by default.

It seems like threading is partially broken in 1.4 and 1.5, e.g.,

#!/usr/bin/guile -s
!#
(use-modules (ice-9 threads))

(begin-thread
 (let looping ()
   (display "1\n")
   (looping)))
(begin-thread
 (let looping ()
   (display "2\n")
   (looping)))
(let looping ()
  (display "3\n")
  (looping))

Running this interactively gives mixed lines 1 2 3, but as a script it stops
after six lines of 1.

The script seems to lock up even if the displays are removed (judging
by CPU usage), so it doesn't have anything to do with I/O.

It seems to work OK in Guile 1.3.4.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]