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


Groups > comp.programming.threads > #1990

Re: Clarification for the handling of sigwaitinfo()

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 2013-11-17 11:11 +0000
Organization Datemas.de http://www.news.datemas.de
Message-ID <20131117111101.3b1f7d9a@bother.homenet> (permalink)
References <bepgirFsghjU1@mid.individual.net> <20131116202321.6916e6ad@bother.homenet> <berhqoFao4nU1@mid.individual.net>

Cross-posted to 2 groups.

Show all headers | 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