scan with timeout
Phil Torre
ptorre at zetron.com
Thu Mar 28 19:33:17 UTC 2002
On Wed, Mar 27, 2002 at 08:09:22AM -0600, Joel Sherrill wrote:
>
>
> Stan wrote:
> >
> > Hi,
> >
> > I should like all input operation (read...scan...) return on timeout.
> > What are best way for that ?
> >
> > This code you seem good ?
> > In fact, the first call to the function scan return on timeout, but not
the
> > following.
> > An idea?
>
> Read up on termios :) It includes POSIX's way of specifying a timeout
> or
> minimum number of bytes to read.
>
>
http://www.opengroup.org/cgi-bin/dbcgix?TPL=sd_formframes&TOKEN=BWBNB&overri
de=sd_search
I don't know if this is relevant to you, but newlib 1.8.2 (from the
rtems-4.5.0
tools) has an interesting feature that effects timeouts on read. If you
read
with a timeout, but no bytes are available, it will time out and return EOF.
All subsequent reads will return immediately with EOF, until such time as
more
bytes are available to read.
To fix this, I commented out lines 49 and 50 of newlib/libc/stdio/refill.c,
and
rebuilt the compiler. (There is probably a faster way to rebuild newlib
than
rebuilding gcc, but this was easier.)
More information about the users
mailing list