bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] flush in the main process but not coprocess?


From: Bob Proulx
Subject: Re: [bug-gawk] flush in the main process but not coprocess?
Date: Sun, 9 Dec 2012 15:10:24 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Aharon Robbins wrote:
> Hi. Re this:
> > I have to use fflush() in the coprocess, otherwise the program hangs.
> > This is documented as the following.
> >
> > I/O buffering may be a problem. gawk automatically flushes all output
> > down the pipe to the coprocess. However, if the coprocess does not
> > flush its output, gawk may hang when doing a getline in order to read
> > the coprocess's results. This could lead to a situation known as
> > deadlock, where each process is waiting for the other one to do
> > something.
> >
> > But when the coprocess was written by somebody else, and I don't have
> > control of, it is not an option to call flush. Is there a walk-around
> > to this problem?
> 
> No, there is no work-around for this problem.  Sorry.

You might want to read this reference which describes the issues in
some detail:

  http://www.pixelbeat.org/programming/stdio_buffering/

Bob



reply via email to

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