This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Named pipes (blocking problem)


I'm trying to build a program that implements inter-process communication
using named pipes.  Because the code needs to also work under Windows
(MSVC++) it uses CreateNamedPipe(...) to create the pipes (described here):-

http://msdn.microsoft.com/en-us/library/aa365150(VS.85).aspx

If I understand the description, it seems that the created pipe can either
be blocking or nonblocking depending on whether the flag
FILE_FLAG_OVERLAPPED is specified at creation time.  The program
reads from the pipe using ReadFile(...) - described here:-

http://msdn.microsoft.com/en-us/library/aa365467(VS.85).aspx

Note that this function takes five parameters - the fifth of which is an
(optional) pointer to an OVERLAPPED struct (LPOVERLAPPED).  A valid pointer
needs to be passed for nonblocking pipes, whereas NULL can be passed for
blocking pipes.

The program in question builds and runs successfully under VC++.  But when
I build the same code under Cygwin, any pipes created seem to be permanently
nonblocking - i.e. if a 'blocking' pipe was originally specified at creation
time, ReadFile(...) will nevertheless return early if there's no data
available to read.  Here are my questions:-

1) Is this a 'known problem' when using ReadFile() in Cygwin?

2)  If Cygwin implements these functions internally, is there a way that I
can force my program to link to the corresponding Windows library (which
seems to be working as expected) instead of linking to Cygwin's
implementation?

I'm currently using Cygwin version 1.5 BTW.

Thanks,

John


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]