On Wed, Oct 24, 2012 at 08:04:37AM -0400, Felix wrote:
> From: Aaron Patterson <tenderl...@ruby-lang.org>
> Subject: [Chicken-users] Pipe and thread problem
> Date: Tue, 23 Oct 2012 14:30:57 -0700
> 
> > Hi, I'm trying to simulate reading from a TTY that writes every two
> > seconds.  I want to do this with a pipe and two threads, one thread
> > writes every N seconds, while the other reads any data available on the
> > pipe.
> > 
> > Unfortunately, my code just hangs.  After speaking with the fine people
> > in #chicken, it seems that this may be a bug.  We played with different
> > calls to put the threads to sleep, and different functions to read data,
> > but they all ended up freezing at some point.
> 
> The ports obtained from calls to "open-[input|output]-file*" use
> internally the "stream-port" class (ports on FILE* streams, in this
> case created via fdopen(3)). These are not thread-aware, AFAICT. Ports
> created for socket-fd's (tcp.scm) and processes (posixunix.scm, see
> specifically ##sys#custom-[input|output]-port") apparently do.

Is there a different way I should be opening the pipe so that it is
thread aware?

-- 
Aaron Patterson
http://tenderlovemaking.com/

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to