🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3159

Re: Throwing an exception from within a signal handler

#3159
From: J. Kanze
Date: Sun, 28 Jan 1996 17:03
35 lines
2548 bytes
In article <4ebptg$frt@galaxy.ucr.edu> thp@cs.ucr.edu (Tom Payne)
writes:

> : From ISO 9899, section 7.7.1.1: ``If the signal occurs other than as the
> : result of calling the abort or raise function, the behavior is undefined
> : if the signal handler calls any function in the standard library other
> : than the signal function itself (with a first argument of the signal
> : number corresponding to the signal tha caused the invocation of the
> : handler) or refers to any object with static storage duration other than
> : by assigning a value to a static storage duration variable of type
> : volatile sig_atomic_t.''
> [...]
> 
> In other words, the only asynchronous activity allowed to programs
> with defined behavior is polling volatile atomic variables that are
> set by signal handlers.  Thus far, no one has given me a reason for
> prohibiting signal handlers from reading volatile atomic variables,
> which is a common practice in interrupt handlers (even those written
> in C/C++).

Correct.  In practice, I cannot conceive of an implementation where
writing something would be atomic, but reading it wouldn't.  On the
other hand, read/modify/write will frequently not be atomic.  And why
else might you want to read an object in a signal handler, if not to
modify it?

-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
              -- A la recherche d'une activité dans une region francophone

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <KANZE.96Jan28160858@gabi.gabi-soft.fr>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <4dgj4m$9la@engnews1.Eng.Sun.COM> <DLCosx.Hn1@falcon.daytonoh.attgis.com> <KANZE.96Jan19122409@gabi.gabi-soft.fr> <4ebptg$frt@galaxy.ucr.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: kanze@gabi.gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c++
Subject: Re: Throwing an exception from within a signal handler
Date: 28 Jan 1996 17:03:06 GMT
Organization: GABI Software, Sarl.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <KANZE.96Jan28160858@gabi.gabi-soft.fr>
References: <4dgj4m$9la@engnews1.Eng.Sun.COM> <DLCosx.Hn1@falcon.daytonoh.attgis.com>
 <KANZE.96Jan19122409@gabi.gabi-soft.fr> <4ebptg$frt@galaxy.ucr.edu>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: gabi.gabi-soft.fr
In-Reply-To: thp@cs.ucr.edu's message of 27 Jan 96 00:18:38 GMT
Content-Length: 1579
Originator: clamage@taumet