a[0] = 1; Thread t = new Thread() { public void run() a[0] += computeSomething(); } }; t.start(); t.join(); System.out.println("Result=" + a[0]);Although this code does not contain race conditions, the only algorithm able to detect this is Dinning-Schonberg.
Back.