[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 17:17:43 +0300

> Date: Fri, 31 May 2013 07:54:43 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Cc: address@hidden
> > Is it really a good idea to leak such low-level details to Gawk
> > program level?  Can't we come up with some higher-level abstraction
> > for this, like conceal the entire while(1) loop in Gawk internals, and
> > present just some operator or function(s) on the Gawk script level?
> The first question is whether to extend the API as I have proposed.
> The next question is how the extension should work.  I think you are
> objecting to providing a "select" function to the user.


> In other words, I think it makes sense to use the extension capability
> to provide the well-known select mechanism.

It is well known to C programmers, but not necessarily to Awk

> I note that read timeouts do not work on MinGw and VMS because select is
> apparently not available, or so it appears from the code in 
> io.c:read_with_timeout.

For Windows, that's not true: one can write 'select' for Windows that
will work for files and devices as well.  It just takes more work,
because the version of 'select' provided by the OS only works for
sockets.  You can see an example of that in gnulib.

> Is there some alternative event dispatching mechanism that works on these
> platforms?

Apart of the facilities to peek at input from non-socket handles,
which can be used to provide Posix-style 'select', Windows provides
many other mechanisms.  Posix platforms, likewise, provide them.  How
about asynchronous I/O, for example?  Why wouldn't that be a better
facility for Gawk?

reply via email to

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