Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1990

Re: Clarification for the handling of sigwaitinfo()

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!news.datemas.de!cvinex--nospam--x.freeserve.co.uk!news
From Chris Vine <chris@cvine--nospam--.freeserve.co.uk>
Newsgroups comp.programming.threads, comp.unix.programmer
Subject Re: Clarification for the handling of sigwaitinfo()
Date Sun, 17 Nov 2013 11:11:01 +0000
Organization Datemas.de http://www.news.datemas.de
Lines 30
Message-ID <20131117111101.3b1f7d9a@bother.homenet> (permalink)
References <bepgirFsghjU1@mid.individual.net> <20131116202321.6916e6ad@bother.homenet> <berhqoFao4nU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace news.datemas.de 9TkFHCTTxNcEPXrgnnpLNP4H8KgBwWG57BbMTqcy9JQIpx/GObZVy+XdBRbz8xZpHXpOV5MpCyNO/0j8ZIOnOWJS9keiL6Zqeop2yWpawThOiuVh7jAiiabqb5VhszybQ0sVisjJx6uCzMWenNNoapE6DHWdR6zmQ4VrOQPkavitdVmFQW1cWg==
X-Complaints-To abuse@datemas.de
NNTP-Posting-Date Sun, 17 Nov 2013 11:11:12 +0000 (UTC)
X-Newsreader Claws Mail 3.9.2 (GTK+ 2.24.22; i686-pc-linux-gnu)
Xref csiph.com comp.programming.threads:1990 comp.unix.programmer:4983

Cross-posted to 2 groups.

Show key headers only | View raw


On Sun, 17 Nov 2013 10:50:16 +0100
Markus Elfring <Markus.Elfring@web.de> wrote:

> > I may have missed it (the code is quite dense) but I could not see
> > on a quick read where you blocked asynchronous delivery of the
> > signal to the process, so that sigwait() could pick it up.
> 
> I thought that my function call "pthread_sigmask(SIG_SETMASK,
> &signal_set, NULL)" does this. Did I interpret the return value of
> the function "sigwaitinfo" in the wrong way here?

So you did, and you preceded it with sigfillset(), so that is fine.

Yes I think it is the return value of sigwaitinfo() which you are
interpreting incorrectly.  According to POSIX:

"Upon successful completion (that is, one of the signals specified by
set is pending or is generated) sigwaitinfo() ... shall return the
selected signal number. Otherwise, the function shall return a value of
-1 and set errno to indicate the error."

I presume here "return the selected signal number" means really return,
not (in the case of success) providing it via the 'info' out parameter
(which it is also required to do if not NULL).  Since no signal number
has value 0, neither success nor failure will return 0.

This is quite confusing, as sigwait() does return 0 in case of success
and provide the signal number via its out parameter.

Chris

Back to comp.programming.threads | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Clarification for the handling of sigwaitinfo() Markus Elfring <Markus.Elfring@web.de> - 2013-11-16 16:16 +0100
  Re: Clarification for the handling of sigwaitinfo() Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2013-11-16 20:23 +0000
    Re: Clarification for the handling of sigwaitinfo() Markus Elfring <Markus.Elfring@web.de> - 2013-11-17 10:50 +0100
      Re: Clarification for the handling of sigwaitinfo() Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2013-11-17 11:11 +0000
        Re: Clarification for the handling of sigwaitinfo() Markus Elfring <Markus.Elfring@web.de> - 2013-11-17 13:30 +0100

csiph-web