Re: JavaMemoryModel: Finalization idioms

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Sat Apr 30 2005 - 20:35:45 EDT


Bob Lee wrote:
> #3 doesn't have the effect you think it does. Those synchronization
> blocks won't have any effect.
>
> Bob
>

Empty synchronization blocks can have an effect as long as the object
being synchronized on is shared across multiple threads. As they would
be in this case.

You may be thinking of thread-local synchronization. If you do:

synchronized(new Object()) {}

That won't have any effect, because the object isn't shared across
multiple threads.

                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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