[concurrency-interest] concurrency puzzle

Peter Veentjer alarmnummer at gmail.com
Tue Sep 12 14:12:50 EDT 2006

I'm stilling thinking about the subject and I trying to think in the
happens before terms.

Another example with a happens before relation

private int a;

public void foo(){
    a = 20;

public void bar(){

In this example, could it happen that 10 is printed?

There is a happens before relation between x=10 and System.out.println
(when the lock is released at the end of the bar method, and acquired
in the foo method.

More information about the Concurrency-interest mailing list