Re: Threading issue in next standard
wkaras@yahoo.com wrote:
kanze wrote:
Chris Thomasson wrote:
<wkaras@yahoo.com> wrote in message
The definition of "observable behavior" in the current
Standard should be fleshed out, but I think it will
always be somewhat open-ended. Maybe the
comparison is with the number of bits in an int,
with a minimum but no max, just a requirement
that you say what it is. If a compiler assets that
it supports multi-threading of a given type, all
threads must "properly see" each others
observable reads/writes.
I would not use that compiler...
Don't worry, nothing that constraining will be adopted.
(Such a policy would require barriers around just about
every access.)
It seems that you (both) are interpreting "observable
reads/writes" to be the same as "all reads/writes". Again let
me repeat, by observable read/write I mean the equivalent of a
read or a write of a volatile variable.
I was. Now that I think about it, I think what Chris was
objecting to is that this "observability" be bound to the type
of the object; typically, what is needed in a multithreaded
context is an explicitly induced point in the program where all
previous writes (regardless of the target type) become visible
(before any of the following writes become visible).
I think that Chris and I agree that volatile is not really
relevant with regards to multithreading. There is a proposal by
Microsoft to give more teeth to volatile. I'm not totally
against the proposal, as I think it goes in the direction of the
original intent of volatile. But I don't think that the
proposal will give volatile any more real relevance with regards
to multithreading. What you usually need in multithreading is a
sequencing guarantee---that (all) preceding writes will become
visible to all observers before any of the following writes.
(Note that this generally implies some sequencing actions on the
part of the observers as well.)
--
James Kanze GABI Software
Conseils en informatique orient9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S9mard, 78210 St.-Cyr-l'cole, France, +33 (0)1 30 23 00 34
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]