Compare-and-Set (Benutzung)

AtomicInteger p;

boolean ok;
do { 
  int v = p.get();
  ok = p.compareAndSet(v,v+1);
} while ( ! ok);



Johannes Waldmann 2011-06-29