// Get the counter value with get() and set it with compareAndSet().
// If compareAndSet() returns false, try again until we get
// through the loop without interference.
int result;
do {
result = count3.get();
} while(!count3.compareAndSet(result, result+1));
return result;