[armedbear-devel] [RFC] Support for 'synchronized' blocks in Lisp code
ville.voutilainen at gmail.com
Tue Jul 7 22:59:01 UTC 2009
On Wed, Jul 8, 2009 at 12:36 AM, Anton Vodonosov<avodonosov at gmail.com> wrote:
> Note, btw, that "synchronized" in java is not only about locking, but
> also about memory synchronization: the code in the synchronized block
> is compiled so that other threads see the changes it has made to
> memory and it sees changes from other threads too. Compiler doesn't
> cache values in registers or other temporary places.
I just read
"Second, when a synchronized method exits, it automatically
establishes a happens-before relationship with any subsequent
invocation of a synchronized method for the same object. This
guarantees that changes to the state of the object are visible to all
The memory changes are committed (just) before a synch block exits.
Not necessarily during the
block. Thus I think the caching is allowed. That thought is further supported by
Of course I may be wrong - but I'd be somewhat surprised if all memory
memory access is volatile
(in the C sense) during a synchronized block. That would take an
enormous perf hit on multi-cpu
systems with IPIs and such.
More information about the armedbear-devel