Article View: comp.std.c++
Article #3138Nonpolled response to asynchronous activity [Was "Throwing ...]
From: Tom Payne
Date: Mon, 29 Jan 1996 22:27
Date: Mon, 29 Jan 1996 22:27
59 lines
3634 bytes
3634 bytes
J. Kanze (kanze@gabi.gabi-soft.fr) wrote:
:
: 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.''
: [...]
And I replied:
: 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++).
Below is what I think does and should happen in practice (stated
somewhat legalistically):
Between sequence points in a given invocation of a function, a
volatile variable may be updated by the given invocation and by
multiple concurrent asynchronous activities, including signal
handlers and functions invoked by them. To achieve coherence,
* prior to each of its sequence points, the function must
"backup" all updated volatile variables.
* after each of its sequence points, the function must
"refresh" local copies of volatile variables,
At a given sequence point in a given function invocation, the
value of a volatile variable will be:
* its value as of the previous sequence point if there have
been no intervening updates of the variable since then;
* the update value if there is exactly one intervening update;
* any of the update values if there are multiple intervening
updates and the variable is atomic;
* unspecified, otherwise.
At each read access of a volatile variable by the given function
invocation and/or concurrent asynchronous activites, the value
obtained will be:
* its value as of the previous sequence point if there are
no intervening updates between that sequence point and the
next;
* that value or any of the update values if the variable is
atomic;
* unspecified, otherwise.
I think that the standards should be fixed to incorporate nonpolled
response to asynchronous activity somewhat along the lines of this
wording.
Tom Payne (thp@cs.ucr.edu)
[ 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:
<4ejgu8$2vc@galaxy.ucr.edu>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageReferences:
<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!engnews2.Eng.Sun.COM!taumet!clamage From: thp@cs.ucr.edu (Tom Payne) Newsgroups: comp.std.c++ Subject: Nonpolled response to asynchronous activity [Was "Throwing ...] Date: 29 Jan 1996 22:27:07 GMT Organization: University of California, Riverside Department of Computer Science Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4ejgu8$2vc@galaxy.ucr.edu> 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: corvette.ucr.edu X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] Content-Length: 2616 X-Lines: 55 Originator: clamage@taumet