[Top][All Lists]

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

Re: [bug-gawk] Adding an API hook to enable a select extension

From: Andrew J. Schorr
Subject: Re: [bug-gawk] Adding an API hook to enable a select extension
Date: Fri, 31 May 2013 11:38:03 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, May 31, 2013 at 06:29:25PM +0300, Eli Zaretskii wrote:
> If a program calls select, it wants to read after that, if data is
> available.  Isn't it better to allow a paradigm "read if available"
> than provide 2 separate building blocks for that?

No, I don't think so.  One could imagine extending the existing READ_TIMEOUT
mechanism to add a special getline return code that indicates a timeout instead
of throwing an error and closing the descriptor.  That might be a good thing,
and should solve the problem posed by the original poster.  But it still
doesn't tell you when to call getline on which file.  For that, you need
select.  Without select, you never know when the data has arrived, so you must
repeatedly call getline with a timeout of zero and loop over each file that
interests you, with a delay in between to avoid a tight loop.  This is terribly
inefficient, and adds latency.  Select was invented to solve this problem.


reply via email to

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