JavaMemoryModel: class initialization (was: Idiom for safe, unsynchronized reads)

From: Paul Haahr (haahr@jivetech.com)
Date: Mon Jul 05 1999 - 14:30:04 EDT


> By the way, we should also guarantee class initialization safety:
> that lack of synchronization doesn't allow you to see the results of
> an incompletely executed class initializer.

My naive understanding is that that's guaranteed by the rules in 12.4.2
of the JLS, which requires a class initializer to synchronize on the
class object.

The worry, I guess, is of a second processor seeing a class as ``fully
initialized,'' but not seeing all the static fields as fully initialized.
But, on the other hand, to properly the detect the class as initialized,
that processor is probably required to insert a memory barrier.

--p
-------------------------------
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 majordomo@cs.umd.edu 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:15 EDT