delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/01/17/17:25:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=4.8 required=5.0 tests=AWL,BAYES_50,BOTNET,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
Message-id: <4F15F549.5010403@cygwin.com>
Date: Tue, 17 Jan 2012 17:25:13 -0500
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-to: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Madness with the 'select' function, sigalrm, and stdout. (CYGWIN_NT-6.1-WOW64)
References: <loom DOT 20120117T231256-287 AT post DOT gmane DOT org>
In-reply-to: <loom.20120117T231256-287@post.gmane.org>
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

On 1/17/2012 5:16 PM, Robert F wrote:
> This could be a cygwin bug, but I'm not 100% sure.  It may even be a weird
> interaction with the windows console.
>
> I have a single threaded app that loops, polls network activity with a 'select'
> function and interrupts the flow of the loop when a SIGALRM signal is ran, the
> handler of which sets a variable that the loop responds to.
>
> While this app more-or-less ran fine in its native linux environment, when
> trying to run it at home in cygwin a problem occurs. Basically, between about
> 2-100 seconds of starting the process (on average), the alarm signal never runs
> as scheduled and never runs again, except for one more time when I hit CTRL+C
> (which I know by inserting debugging output into the signal handler).
>
> The funny thing is the app happily continues looping and calling the 'select'
> function, it just never gets interrupted by an alarm signal. The select function
> handles cases of EINTR where it was interrupted by an alarm, btw (sockets are
> nonblocking and timeout is 1 second).
>
> Now here's the REALLY weird bit. IF I insert a printf (with newline terminated
> string) after the select function, _the problem never occurs_.  If there's no
> newline, the printed strings are buffered without being shown, until either a
> newline arrives or I hit CTRL-C.
>
> Doesn't work if I put it before the select function, only after.
>
> I haven't included any io streams into the fd_sets passed to the select
> function, in case you were wondering. They are zeroed and then only receive
> network connections.
>
> This has me stumped.

I'd suggest trying a snapshot - <http://cygwin.com/problems.html>

If that doesn't help, a full problem report might help someone on the list
spot an issue.

> Problem reports:       http://cygwin.com/problems.html

-- 
Larry

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

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

- Raw text -


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