Pipe syncronization and incompatibility between Cygwin and .NET Framework 4.0

Lavrentiev, Anton (NIH/NLM/NCBI) [C] lavr@ncbi.nlm.nih.gov
Mon Dec 23 19:05:00 GMT 2013


> Check line 192 for a call to the WaitForAvailableConsoleInput function.

I guess they expect hFile to be a console handle (which IS waitable).

And my guess that they added the Peek intentionally to prevent
the WaitFor call from slipping through (as we've seen it does, otherwise)
on things that weren't supposed to be there (such as pipes).
They probably know of a side effect of peeking a pipe, which makes
the WaitFor API block on them (thus, still create a good cancellation
point for the thread) -- again, as they would not expect a pipe there (but
a good console handle;  and if it isn't -- well, it's by design).

But I'm only speculating here.  On the other hand, I would not be surprised
to learn that one team in MS would not know how to deal with the pipes and
introduced a bug, easily.  MS is a large company, and I witnessed such
things to happen in teams of a much smaller scale, from my own experience.

In our apps we use the Peek everywhere for pipe polling, and do not
rely on anything else.

And from Cygwin point of view, I was trying to deal with mixing native
Windows things and UNIX, and it seems to be a big no-no, from the entire
design point -- Cygwin is not a tool for be-friending Windows and Unix,
rather a way to run your beloved GNU tools on a Windows box.

Sorry you ran into this trouble...

Anton Lavrentiev
Contractor NIH/NLM/NCBI


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list