Java's AtomicInteger
offers public final boolean compareAndSet(int expect, int update)
. If false
is returned, I would like to know what the value actually was at the time when the comparison failed. Is this possible in Java?
In .Net, there's public static int CompareExchange(ref int location1, int value, int comparand)
, which always returns the original value.