Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.programming.threads,comp.unix.programmer Subject: Re: Combination of sigwait() with sigaction()? Date: Thu, 21 Nov 2013 17:02:50 +0000 Lines: 19 Message-ID: <87zjox7kn9.fsf@sable.mobileactivedefense.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net EiFF4kuCyjVUaIDHniIBIAzECDq3uoiYv7dozNF3ClEzS84IM= Cancel-Lock: sha1:CjCDhaIg/QdQI5iWCxcj4FGFh5c= sha1:A2nDiqjS6y+fwErS+XVrIKbykU0= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Xref: csiph.com comp.programming.threads:1996 comp.unix.programmer:5001 Markus Elfring writes: > I have found an interesting article about waiting for signals in a separate > thread. A source code skeleton is shown. > http://devcry.heiho.net/2009/05/pthreads-and-unix-signals.html > > The author suggested also to install an empty signal handler by the function > "sigaction". How do you think about this suggestion? > Is the mentioned indication of non-default signal actions useful here? The author is somewhat confused here: sigwait returns "pending signals", this means "signals which don't cause any 'action' because they're blocked", hence, no "default actions" will happen. But the disposition of a signal can be set to something other than "default action" or "signal handler", namely, to "ignore this signals" and signals set to be ignored don't become pending signals, they're just discarded (and hence, sigwait will never return them). The main annoyance here is that the default disposition of SIGCHLD is "ignore", hence, without setting that to something else, sigwait (and similar routines) will never return a SIGCHLD.