Article View: comp.lang.c++.moderated
Article #37Re: Meaning of the specifier volatile?
From: Tom Payne
Date: Thu, 11 Jan 1996 18:42
Date: Thu, 11 Jan 1996 18:42
36 lines
2372 bytes
2372 bytes
X-Original-Date: 6 Jan 1996 21:57:16 GMT
[moderator's note: This posting was apparently lost or delayed somewhere in the
'net, and we am re-posting it. Please bear with us if this is a duplicate.]
J. Kanze (kanze@gabi-soft.fr) wrote:
[stuff deleted]
: On point concerning volatile that I have not seen made is the fact that
: the C/C++ concept of volatile is orthogonal to atomicity of access.
: Declaring an object volatile is *NOT* sufficient with regards to
: asynchronous events; the object must still be of a type for which the
: compiler will generate atomic accesses.
[stuff deleted]
Because of the signal-handlers-can't-read provision of the ANSI C
standard, atomicity is unnecessary in the coordination of asynchronous
activity for programs with defined behavior:
* signal handlers won't read any partially written non-atomic
shared variables, because they are not allowed to read variables
of static storage class in programs with defined behavior.
* the program itself won't read any partially written non-atomic
shared varible, because signal handlers don't return control
until they have completed their writes of volatile variables.
With pre-emptive multithreading, of course, the possibility of
pre-emption during a non-atomic write requires atomicity of some
coordination variables, but it's impossible to introduce
multithreading and stay within defined behavior per the ANSI
standard.
Tom Payne (thp@cs.ucr.edu)
[ comp.lang.c++.moderated is a moderated newsgroup. Submit articles ]
[ to <c++-submit@netlab.cs.rpi.edu>. The moderation policy can be ]
[ retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>. ]
[ Moderators can be reached at: c++-request@netlab.cs.rpi.edu. ]
Technical Details
Message-ID:
<4d3lni$rug@netlab.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mailReferences:
<4c9740$27n@netlab.cs.rpi.edu> <4cff74$gfj@netlab.cs.rpi.edu> <4cj5u4$qjm@netlab.cs.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mail From: thp@cs.ucr.edu (Tom Payne) Newsgroups: comp.lang.c++.moderated,comp.lang.c++ Subject: Re: Meaning of the specifier volatile? Date: 11 Jan 1996 18:42:58 -0000 Organization: University of California, Riverside Department of Computer Science Sender: cppmods@netlab.cs.rpi.edu Approved: Dietmar.Kuehl@uni-konstanz.de Message-ID: <4d3lni$rug@netlab.cs.rpi.edu> References: <4c9740$27n@netlab.cs.rpi.edu> <4cff74$gfj@netlab.cs.rpi.edu> <4cj5u4$qjm@netlab.cs.rpi.edu> NNTP-Posting-Host: netlab.cs.rpi.edu