Possible language changes

Boehm, Hans hans.boehm at hp.com
Tue Mar 1 20:13:04 GMT 2005


> -----Original Message-----
> From: Doug Lea [mailto:dl at cs.oswego.edu] 
> > 
> > 4) Should volatile reads/writes count as synchronization operations 
> > and have acquire/release semantics as in Java?  I would argue yes.  
> > But this is a significant change on many platforms (though not 
> > Itanium), and is controversial.
> 
> Can anyone think of any compelling objection to this?
> It seems like the only viable approach. It would also be
> good to settle on this soon to get reaction.
> 
I think Maged had some legitimate concerns about this.  It would be
useful to look at real examples.

I think the generic objection is something like: I already use volatiles
to ensure some weaker property on my hardware.  Adding acquire/release
semantics adds memory barrier overhead on my platform, which I don't
need.  It would be nice to understand the weaker properties that might
be desirable, and to ensure that the atomic operations library can
provide those.

It seems to me that at the moment, there is enough platform variation
in the meaning of "volatile" that it's hard to use it in portable code.

This brings up another important and tricky question:  When does
"volatile" imply atomicity?

Hans






More information about the cpp-threads mailing list