|
| From: | Chet Ramey |
| Subject: | Re: [PATCH] Fix blocking read timeouts at a small probability |
| Date: | Wed, 10 Feb 2021 10:21:26 -0500 |
| User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
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.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
| [Prev in Thread] | Current Thread | [Next in Thread] |