public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Matthias Andree" <matthias.andree@gmx.de>
To: cygwin@cygwin.com
Subject: Re: select() hanging after terminal killed
Date: Thu, 29 Apr 2010 16:40:00 -0000	[thread overview]
Message-ID: <op.vbxlddbm1e62zd@balu.cs.uni-paderborn.de> (raw)
In-Reply-To: <4BD989A9.4080402@towo.net>

Thomas Wolff wrote on 2010-04-29:

> On 29.04.2010 13:28, Matthias Andree wrote:
>> Am 29.04.2010 12:53, schrieb Thomas Wolff:
>>
>> [on closed terminal]
>>
>>> On Linux, select() indicates an exception and EIO.
>>> On SunOS, select() indicates both an exception and input (weird),
>>>
>> Not weird, you appear to be misunderstanding select().
>> An IEEE Std 1003.1 compliant select():
>>
>>   - only states that a subsequent read() will *not block*
>>     this includes EOF and error, as they make read() return without  
>> blocking)
>>
>>   - makes *no statements about success*
>>
> Oh, right, so apparently Linux is wrong here (since it does not report  
> read availability...).

Arguably yes, probably an omission in your system. (Note that older POSIX  
versions didn't specify that errors means readability).

Please look if a relevant bug is filed, and if not, please do so.

>>> On Cygwin, the following is observed:
>>> * EOF is not signalled on read(); rather EIO is indicated right away.
>>>    (Maybe not too bad, an application can handle that as well.)
>>> * select() with timeout hangs.
>>>
>>> Especially the latter can hardly be handled by an application.
>>>
>> Pointers for workarounds: alarm(), signal().
>>
> So I could setup alarm() to get myself signal()ed while waiting in a  
> long sleep().
> But the granularity is in seconds only, so this is not a substitute for  
> most use cases typically handled by calling select().
> Thanks for the information anyway.

Rather than discussing the downsides, you might more efficiently just read  
the standard, or the system documentation, which would then point you to  
setitimer().

-- 
Matthias Andree

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

  reply	other threads:[~2010-04-29 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 11:28 Thomas Wolff
2010-04-29 12:17 ` Matthias Andree
2010-04-29 14:18   ` Thomas Wolff
2010-04-29 16:40     ` Matthias Andree [this message]
2010-04-29 15:19 ` Corinna Vinschen
2010-04-29 15:24   ` Christopher Faylor
2011-05-26 22:44 Thomas Wolff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.vbxlddbm1e62zd@balu.cs.uni-paderborn.de \
    --to=matthias.andree@gmx.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).