[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] problem with gforth7 and serial access

From: Bernd Paysan
Subject: Re: [gforth] problem with gforth7 and serial access
Date: Thu, 22 Mar 2012 16:58:21 +0100
User-agent: KMail/4.7.2 (Linux/3.1.9-1.4-desktop; KDE/4.7.2; x86_64; ; )

Am Donnerstag, 22. März 2012, 16:44:53 schrieb David Kuehling:
> >>>>> "Bernd" == Bernd Paysan <address@hidden> writes:
> > I don't know why the select code should not work on serial lines, this
> > must be a bug in Linux.
> Sure, that this is not a bug in Gforth code?  Select() is pretty
> difficult to get right.  E.g. you must read all input data until read()
> returns EAGAIN, before calling select().  Failing to do so will make
> select() block forever, as select is "edge triggered", and only returns
> if the state of "data available" has a transition.

Are you sure about that?  The manpage states the function of select to mark
every file that "is or became ready" for IO.  With epoll, you have the
opportunity to select edge or level-triggered events, but select pretty much
specifies level-triggered, at least according to the manpage.  Our files are
blocking, so we will never get EAGAIN from read().

Well, maybe it's such a combination, i.e. changing a file to non-blocking and
then try to use key_avail on it, which is going to fail, but worked fine

IIRC, ioctl(FIONREAD) did not work on files, that's why we dropped it.

Bernd Paysan
"If you want it done right, you have to do it yourself"

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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