// Page 150 example doesn't work // This fixes it. import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicIntegerArray; public class Alock implements SimpleLock { final static ThreadLocal mySlotIndex = new ThreadLocal(); final AtomicInteger tail = new AtomicInteger(0); AtomicIntegerArray flag; public Alock() { flag = null; } public void init(int th) { flag = new AtomicIntegerArray(th); for(int i=0;i