delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/09/19/18:07:19

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 951183858D28
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=lyx.org
Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lyx.org
Message-ID: <1b28b650-b588-e34f-919e-e75f5a01196f@lyx.org>
Date: Tue, 20 Sep 2022 00:05:57 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.2.1
To: cygwin AT cygwin DOT com
References: <a3084ca6-ea7b-535c-c0fb-2c29e20b7ddb AT cornell DOT edu>
From: Enrico Forestieri <forenr AT lyx DOT org>
Subject: Re: FIFO issues
In-Reply-To: <a3084ca6-ea7b-535c-c0fb-2c29e20b7ddb@cornell.edu>
X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00, HTML_MESSAGE,
KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A,
RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

Ken Brown wrote:

 > I did an internet search on this issue and found the following, which 
describes the

 > situation we're discussing:

> https://stackoverflow.com/questions/14594508/fifo-pipe-is-always-readable-in-select  

 > According to that post, select on Linux will wait for a writer the 
first time it's

 > called to check read readiness for a FIFO opened for reading with 
O_NONBLOCK set.

 > But if the writer then closes the FIFO, subsequent calls to select 
will always find

 > the FIFO read ready (and read will return 0). This behavior is not 
documented, as far as

 > I can tell, and in fact it contradicts the existing documentation 
(both POSIX and Linux).

 > So I don't think someone trying to write a portable program should 
rely on it.


Please, note that this code was working on cygwin the way it works on 
linux until some

time ago, maybe last year, I am not sure. I also found this 
stackoverflow discussion:

https://stackoverflow.com/questions/28851639/select-with-non-blocking-reads

I tried the code also on Solaris and NetBSD and it works exactly as on 
linux, so I think

it is portable.


-- 

Enrico

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

- Raw text -


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