> -----Original Message-----
> From: email@example.com
> [mailto:firstname.lastname@example.org]On Behalf Of Dan Scales
> 5) One way to support the initialize-once idiom so that it is
> reasonably efficient on all types of machines is to add a new
> keyword 'sync' that qualifies variables. Any read of a 'sync'
> variable acts as an acquire and any write of a 'sync' variable
> acts as a release. If a reference to a newly constructed object
> is stored in a sync variable, then other processors reading the
> variable will be guaranteed to see the correct contents of the new
Instead of adding a new keyword we could simply hijack 'volatile' to mean
this. After all our general rule for accessing mutable fields is that it
must be done under synchronisation or the field must be declared volatile.
For object references having the reference a volatile doesn't achieve any
useful guarantees about the state of the object's fields, so enhancing
volatile in this way would seem to be a good thing to do and fairly clean.
Overall I find the proposal to be a good compromise on programmability and
This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.
To send a message to the list, email JavaMemoryModel@cs.umd.edu
To send a request to the list, email email@example.com and put
your request in the body of the message (use the request "help" for help).
For more information, visit http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:16 EDT