[Top][All Lists]

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

Re: [Chicken-users] Pipe and thread problem

From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] Pipe and thread problem
Date: 24 Oct 2012 16:21:36 +0200

Without having seen the code in question:
my guess would be that those FILE*-ports would
do i/o-buffering. flush-output might already help.

On Oct 24 2012, Felix wrote:

From: Mario Domenech Goulart <address@hidden>
Subject: Re: [Chicken-users] Pipe and thread problem
Date: Wed, 24 Oct 2012 09:44:37 -0400

Hi Felix,

On Wed, 24 Oct 2012 08:04:37 -0400 (EDT) Felix <address@hidden> wrote:

From: Aaron Patterson <address@hidden>
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

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.

From a user perspective (i.e., without knowing how things are
implemented by Chicken), how can we know what procedures can be used
with threads?

Only from the documentation. I'm not sure I understand the question.
It also depends on how likely blocking is.

Wouldn't such a misuse of I/O operations in the presence of threads be
a possible cause of #858?

#858 refers to socket ports, which are implemented differently from
the ports that refer to files. Note that spiffy also involves sendfile,
which _does_ non-blocking I/O for files. I think.


Chicken-users mailing list

reply via email to

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