RE: JavaMemoryModel: Re: JMM problems with latch or copy-on-write ?

From: Bill Pugh (
Date: Fri Mar 30 2001 - 13:51:47 EST

This works as Hans describes in our memory model. An empty
synchronized block can be very useful. Synchronizing on thread local
objects, on the other hand, has no effect.

At 10:28 AM -0800 3/30/01, Boehm, Hans wrote:
>I think the last parenthetical comment is an overgeneralization. Consider
>Thread 1:
>synchronized(global1) {
> thread2.start();
> set up some global shared state S;
>read S;
>Thread 2:
> synchronized(global1){}
> read S;
>The empty synchronized block is used to wait for the initialization of S.
>Removing it is clearly incorrect.
>This is probably uncommon in Java, but I believe it's correct under all
>current proposals. I've used it a few times with a pthreads like thread
>model, without s separate start operation.
>JavaMemoryModel mailing list -

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