Cygwin select() issues and improvements

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Feb 15 12:57:00 GMT 2016


On Feb 14 03:09, john hood wrote:
> [I Originally sent this last week, but it bounced.]
> 
> Various issues with Cygwin's select() annoyed me, and I've spent some
> time gnawing on them.
> 
> * With 1-byte reads, select() on Windows Console input would forget
> about unread input data stored in the fhandler's readahead buffer.
> Hitting F1 would send only the first ESC character, until you released
> the key and another Windows event was generated.  (one-line fix, though
> I'm not sure it's appropriate/correct)

I think so, yes.  I applied this patch, thank you.

With the other patches I have two problems.

One of them is that they are not trivial enough to be acceptable without
copyright assignment (except patch 3, but see below).  Please have a
look at https://cygwin.com/contrib.html, the "Before you get started"
section.  There's a link to an "assign.txt" file with instructions.

The other one is just this:  Can you please describe each change in the
accompanying patch comment so that it's accessible from the git log?

> * Newer versions of Windows may return early on timers, causing select()
> to return early. (fixed, but other timers in Cygwin still have this problem)

It would be nice if we could discuss this a bit more in detail.  I wasn't
aware of this change.

> * The main loop in select() has some pretty tangled logic.  I improved
> that some.  There's room for more improvement

Definitely.

> but that would need
> changing fhandlers and related functions.

If it makes sense, sure.

> Windows scheduling in general seems to be rather poor for Cygwin
> processes, and there are scheduling differences between processes run in
> Windows console (which are seen as interactive by the scheduler) and
> processes run in mintty (which are not).  There doesn't seem to be any
> priority promotion for I/O as you see on most Unix schedulers.

I'm not aware of such a feature.

> I've attached plausible patches; they're also available on
> <https://github.com/cgull/newlib-cygwin>, branch 'microsecond-select'.
> I think it's all Windows XP compatible.  I've put some test programs up
> at <https://github.com/cgull/cygwin-timeouts> too.

XP/2K3 compatibility is not required anymore.  If you think you need
a feature which is only available on Vista or later, feel free.  We just
have to inform the Cygwin mailing list, as promised.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20160215/ae8daacc/attachment.sig>


More information about the Cygwin-patches mailing list