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


Groups > comp.programming.threads > #1109

Re: Safe accesses of global arrays in signal handlers?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader03.nrc01.news.zen.net.uk.POSTED!not-for-mail
Newsgroups comp.programming.threads, comp.unix.programmer
From Geoff Clare <geoff@clare.See-My-Signature.invalid>
Subject Re: Safe accesses of global arrays in signal handlers?
References <accvmcFog2gU1@mid.individual.net> <pan.2012.09.25.11.15.59.228000@nowhere.com> <acik2gF3panU1@mid.individual.net> <pan.2012.09.27.12.35.52.872000@nowhere.com>
User-Agent XPN/1.2.6 (Street Spirit ; Linux)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Date Fri, 28 Sep 2012 13:39:30 +0100
Message-ID <2digj9-fjk.ln1@leafnode-msgid.gclare.org.uk> (permalink)
Lines 28
Organization Zen Internet
NNTP-Posting-Host e43bf396.news.zen.co.uk
X-Trace DXC=8jnNgIJ>4Lnko]em;Y=Pd`f2FgniPJjgb=dR0\ckLKG`WeZ<[7LZNRfMZl7=;>L25gGe\aWc^ahef0ETdE17DIfk5BH3gX6aE6j
X-Complaints-To abuse@zen.co.uk
Xref csiph.com comp.programming.threads:1109 comp.unix.programmer:3363

Cross-posted to 2 groups.

Show key headers only | View raw


Nobody wrote:

> Doing anything substantial in a signal handler is problematic. So
> typically you just want to notify a thread which blocks until
> notification. There are a few async-signal-safe functions which can be
> used for notification, including sem_post(), sigqueue(), raise() and
> write(). A complete list is at:
>
> http://pubs.opengroup.org/[...]/functions/V2_chap02.html#tag_15_04_03
>
> Note that none of the pthread functions are in that list.

That's going to change in SUSv4 TC1 (which is finished but awaiting
final approval by IEEE and The Open Group). It adds pthread_equal(),
pthread_kill() and pthread_sigmask() to the list of async-signal-safe
functions.

Note that the additions are not because the standard developers' expect
them to be used for anything useful in signal handlers. They are being
done to correct some inconsistencies. Namely that raise(sig) is required
to be equivalent to pthread_kill(pthread_self(), sig) and raise()
is async-signal-safe, and that pthread_sigmask() is required to be
equivalent to sigprocmask(), without the single-thread restriction, and
sigprocmask() is async-signal-safe.

-- 
Geoff Clare <netnews@gclare.org.uk>

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


Thread

Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-25 08:01 +0200
  Re: Safe accesses of global arrays in signal handlers? Nobody <nobody@nowhere.com> - 2012-09-25 12:15 +0100
    Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-27 11:20 +0200
      Re: Safe accesses of global arrays in signal handlers? Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-09-27 13:23 +0100
        Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-28 13:25 +0200
      Re: Safe accesses of global arrays in signal handlers? Nobody <nobody@nowhere.com> - 2012-09-27 13:35 +0100
        Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-28 13:48 +0200
          Re: Safe accesses of global arrays in signal handlers? Johann Klammer <klammerj@NOSPAM.a1.net> - 2012-09-28 18:34 +0200
            Re: Safe accesses of global arrays in signal handlers? scott@slp53.sl.home (Scott Lurndal) - 2012-09-28 17:54 +0000
          Re: Safe accesses of global arrays in signal handlers? Nobody <nobody@nowhere.com> - 2012-09-28 18:26 +0100
            Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-29 13:44 +0200
              Re: Safe accesses of global arrays in signal handlers? Nobody <nobody@nowhere.com> - 2012-09-29 20:37 +0100
                Re: Safe accesses of global arrays in signal handlers? William Ahern <william@wilbur.25thandClement.com> - 2012-09-29 17:31 -0700
                Signal handlers writing into pipes Markus Elfring <Markus.Elfring@web.de> - 2012-09-30 13:21 +0200
                Re: Safe accesses of global arrays in signal handlers? Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-10-01 18:04 +0100
                Signal handlers writing into pipes Markus Elfring <Markus.Elfring@web.de> - 2012-10-03 16:36 +0200
                Re: Signal handlers writing into pipes Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-10-03 17:07 +0100
                Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-30 13:12 +0200
                Re: Safe accesses of global arrays in signal handlers? Nobody <nobody@nowhere.com> - 2012-09-30 20:46 +0100
        Re: Safe accesses of global arrays in signal handlers? Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2012-09-28 13:39 +0100
        Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-29 13:15 +0200
          Re: Safe accesses of global arrays in signal handlers? William Ahern <william@wilbur.25thandClement.com> - 2012-09-29 17:42 -0700
            Re: Safe accesses of global arrays in signal handlers? Markus Elfring <Markus.Elfring@web.de> - 2012-09-30 14:04 +0200
  Re: Safe accesses of global arrays in signal handlers? Rainer Weikusat <rweikusat@mssgmbh.com> - 2012-09-25 13:27 +0100

csiph-web