[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read with very small timeout sometime hand on stdin
From: |
Chet Ramey |
Subject: |
Re: read with very small timeout sometime hand on stdin |
Date: |
Wed, 28 Oct 2020 09:23:09 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.3.3 |
On 10/28/20 7:06 AM, felix wrote:
> Bash Version: 5.1
> Patch Level: 0
> Release Status: rc1
>
> Description:
> Trying to see limits of timeout with `read -t`, I encounter strange
> and unconstant result: sometime `read -t .000001` don't consider
> timeout, when running fastly multiple time.
I can't reproduce this using the following stripped-down reproducer:
trap 'echo $f ; exit' SIGINT
for f in {1..10000}; do
read -t .000001 v
if [ $? -ne 142 ]; then
echo $f: $?
fi
done
> Ok, then microsecond seem to by smallest value.
Yes, the smallest granularity is microseconds. The code uses interval
timers and timevals.
--
``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/