delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/22/11:51:27

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
X-Trace: 119166432/mk-filter-4.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.66.17.75/None/johne53 AT tiscali DOT co DOT uk
X-SBRS: None
X-RemoteIP: 79.66.17.75
X-IP-MAIL-FROM: johne53 AT tiscali DOT co DOT uk
X-MUA: Microsoft Outlook Express 6.00.2900.2180Produced By Microsoft MimeOLE V6.00.2900.2180
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApwEANlTT0lPQhFL/2dsb2JhbACEVboqWI93hkM
Message-ID: <005b01c96455$6c6bed60$4001a8c0@mycomputer>
From: "John Emmas" <johne53 AT tiscali DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
Subject: Named pipes (blocking problem)
Date: Mon, 22 Dec 2008 16:50:40 -0000
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019