[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: Eli Zaretskii
Subject: Re: [bug-gawk] Adding an API hook to enable a select extension
Date: Fri, 31 May 2013 20:51:04 +0300

> Date: Fri, 31 May 2013 11:38:03 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Cc: address@hidden, address@hidden
> 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.

It will, if getline would return a special code for "no data ready".
Then you just try reading, and that's it.  No need for an explicit
'select' call.

> 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.

You are confusing a feature and its implementation.  The feature is an
ability to call readline and have it return some indication that
there's nothing to read.  The implementation is to use 'select' (or

reply via email to

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