Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 23:30:13 GMT
From:      David Xu <davidxu@freebsd.org>
To:        freebsd-threads@FreeBSD.org
Subject:   Re: threads/94176: KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH
Message-ID:  <200604272330.k3RNUDeo088408@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR threads/94176; it has been noted by GNATS.

From: David Xu <davidxu@freebsd.org>
To: eugeny gladkih <john@drweb.com>
Cc: Andriy Gapon <avg@icyb.net.ua>,
 bug-followup@freebsd.org
Subject: Re: threads/94176: KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH
Date: Fri, 28 Apr 2006 07:24:09 +0800

 On Friday 28 April 2006 00:50, eugeny gladkih wrote:
 > >>>>> "AG" == Andriy Gapon <avg@icyb.net.ua> writes:
 >
 >  AG> David, John,
 >
 >  AG> maybe it would be beneficial to the general programmer public to add
 >  AG> something similar to the NOTES section of the following man page to
 > our AG> man page for sigwait:
 >  AG> http://condor.wesleyan.edu/cgi-bin/man.cgi?section=2&topic=sigwait
 >
 >  AG> Using the original example, it would mean adding something like the
 >  AG> following code to get the desired behavior:
 >
 >  AG> void dummy_handler(int signum)
 >  AG> {
 >  AG>         return;
 >  AG> }
 >
 >  AG> void *thread(void* unused) {
 >  AG>   struct sigaction sa;
 >  AG>   sa.sa_handler = dummy_handler;
 >  AG>   sigemptyset(&sa.sa_mask);
 >  AG>   sa.sa_flags = 0;
 >  AG>   sigaction(SIGWINCH, &sa, NULL);
 >  AG> .
 >  AG> .
 >  AG> .
 >
 >
 > why so stupid code should be presented in all software wanted
 > just to wait the signal? :(
 >
 > sigwait'ed signal is not ignored one! we DON'T ignore it we DO
 > wait for it. I'm afraid there is another problem with SIGTERM
 > which will terminate process. am I right, yeah?
 
 hmm, there is always race condition between userland and kernel,
 guess what will happen if your thread is executing userland code and
 a signal is being delivered to the process whose action is IGNORE ?
 you are not waiting for the signal.
 the dummy signal action you have to install can only help you to catch 
 bug if you forgot to mask it. in history, BSD throws aways signal
 immediately if the signal action is IGNORE, otherwise an ignored signal
 may cause a sleep to be interrupted, this can happen according to
 current sleep queue code and signal code.
 
 David Xu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604272330.k3RNUDeo088408>