Re: JavaMemoryModel: Idiom for safe, unsynchronized reads

From: Joshua Bloch (
Date: Mon Jun 28 1999 - 15:01:25 EDT

-----Original Message-----

From: Doug Lea <>

>Consider the use of simple classes like String and Integer. One of the
>original motivations for declaring these classes as immutable wass for
>the sake of thread safety.


>Should there be two versions, one of which uses synch in its constructor
>and one not? Or should people put synch blocks only when constructing
>those that the believe might be accessible across threads?

   It's not enough to synch the constructor! An unlock action in the writer
without a lock action in the reader is useless.

>No answers along these lines strike me as tolerable.
>I think the only choice here is for the semantics to guarantee safety.

    I agree wholeheartedly.


This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email
To send a request to the list, email and put
your request in the body of the message (use the request "help" for help).
For more information, visit

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:13 EDT