This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Pipe syncronization and incompatibility between Cygwin and .NET Framework 4.0
- From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr at ncbi dot nlm dot nih dot gov>
- To: James Johnston <JamesJ at motionview3d dot com>
- Cc: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Fri, 20 Dec 2013 22:39:18 +0000
- Subject: RE: Pipe syncronization and incompatibility between Cygwin and .NET Framework 4.0
- Authentication-results: sourceware.org; auth=none
- References: <02ee01cefdce$9c343300$d49c9900$ at motionview3d dot com>
MSDN does not list pipe handles as waitable with WaitForMultipleObjectsEx
(only a user comment at the end does). If you trace execution without
PeekNamedPipe(), you'll see that WaitForMultipleObjectsEx() returns
immediately, and that it is ReadFile() that blocks and waits for
the input (which will be supplied after 3 seconds).
--quote--
The WaitForMultipleObjectsEx function can specify handles of any of the following object types in the lpHandles array:
Change notification
Console input
Event
Memory resource notification
Mutex
Process
Semaphore
Thread
Waitable timer
--quote--
Also from here:
http://stackoverflow.com/questions/14203618/windows-api-wait-for-data-to-be-available-on-non-gui-console-input-pipe-based
--quote--
Is it possible to wait for data to be available on a non-GUI-based console input? The issue is that WaitFor* methods do not support PIPE handles and therefore STDIN is not supported if the process input is fed from another process, e.g. using the pipe | functionality of cmd.
The only way I know to query a pipe for data without actually reading the data is to use PeekNamedPipe(), but then you lose the ability to wait on a timeout effectively, because it has no timeout so you would have to implement a manual loop instead.
--quote--
HTH,
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