www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/11/15:53:55

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <496A5C5D.9030703@gmail.com>
Date: Sun, 11 Jan 2009 20:53:49 +0000
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Signal handling in Win32 GUI programs
References: <496A1DBC DOT 7070004 AT gmail DOT com> <20090111163729 DOT GB9992 AT ednor DOT casa DOT cgf DOT cx> <496A24DE DOT 1080101 AT gmail DOT com> <20090111180740 DOT GC10049 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20090111180740.GC10049@ednor.casa.cgf.cx>
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

>> I've added a thread doing 'for (;;) pause();', but unfortunately that 
>> doesn't seem to do the trick. Do I need to go into Cygwin internals and 
>> wait directly on the Win32 event(s) used for signals?
> 
> sigwait() will probably work better than pause.

That indeed works, thank you very much! I didn't know that function, 
very handy. With that and threads, signal handlers with all their 
vagaries aren't really needed anymore, are they?

And speaking of threads, does it make a difference whether one uses 
Pthreads or Win32 threads? I mean apart from portability and the small 
overhead Pthreads presumably incur.

MinTTY's got three such little helper threads hanging about now, doing 
waitpid() on the child process, read() on the child pty, and the 
abovementioned sigwait(). Would there be any point in trying to 
consolidate them into a single sigwait() process, using SIGCHLD and 
asynchronous reads?

Andy


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