On 2/10/21 10:21 AM, Chet Ramey wrote:
On 2/8/21 9:37 AM, Koichi Murase wrote:
Instead, I believe, it is more natural to use `select(2)', which is
already used to implement `read -t 0'. In the attached patch
`0001-Use-select-2-for-the-read-timeout.patch', I used `select(2)'
to implement the timeout of `read(2)'. When `select(2)' is
unavailable (i.e., `HAVE_SELECT' is defined in `config.h'), it still
falls back to the old strategy with `SIGALRM', but I believe most of
modern systems support `select(2)'. I tested the behavior with the
above test case, and also tested the behavior by hand. Could you
take a look at the patch?
Thanks for the analysis and patch. I'll take a look. At first glance, I
would like to find a simpler way to do it.
I'd also like to know how this is going to work with read -e and readline,
since those don't seem to know anything about the timer.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/