X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.5 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_FD
X-Spam-Check-By: sourceware.org
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX1/whH/Gtu/1Hfhoe60+OZMz
Date: Sat, 12 Jan 2013 14:14:51 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: select() not interrupted by signals
Message-ID: <20130112191451.GA16929@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <50EFD041.4090108@towo.net> <20130111153857.GB3450@ednor.casa.cgf.cx> <50F1A047.7080109@towo.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <50F1A047.7080109@towo.net>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Sat, Jan 12, 2013 at 06:41:27PM +0100, Thomas Wolff wrote:
>Am 11.01.2013 16:38, schrieb Christopher Faylor:
>> On Fri, Jan 11, 2013 at 09:41:37AM +0100, Thomas Wolff wrote:
>>> I had previously reported "select() hanging after terminal killed"
>>> (http://cygwin.com/ml/cygwin/2011-05/msg00418.html).
>>> It turns out that select() does not get interrupted by a SIGWINCH signal
>>> either (with likely the same cause).
>>> This raises problems with interactive programs that want to react to
>>> window size changes (like text editors).
>>>
>>> See attached updated test case; run the program, while select() is
>>> waiting (before 5 second timeout each), change window size and see no
>>> interrupt.
>> "No interrupt"?  I see a "HUP" but select() keeps going.  That was the
>> way I designed it but apparently that differs from the way Linux works.
>> select() is not restartable like read() or write().
>>
>> That behavior should be fixed in the next snapshot.  If you are seeing
>> something different than this then that is not fixed.
>After Corinna wrote:
>> You could test using the binary...
>Yes, fixed with latest snapshot, thanks a lot. At least as far as I am 
>concerned, i.e.
>Not sure what exactly you mean with "select is not restartable" -

http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Look for "restart".

>actually, that made me test again more deeply, and it seems you 
>interrupt select() now on every signal;
>as I understood it should only get interrupted on a signal related to a 
>file descriptor for which the bit in the exceptfds vector is set...
>I'll recheck that on Unix next week.

I have standard test cases for select() which do not use the "exceptfds"
field.  They are interrupted by a signal on both Linux and Cygwin.  I
don't see anything in the Single Unix Specification or Linux man page
which would indicate that signals are in any way related to exceptfds.

Also:

http://stackoverflow.com/questions/1342712/nix-select-and-exceptfds-errorfds-semantics

cgf

--
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

