On Mon, 26 Dec 2011 15:06:57 -0600, Andrew Wiley wrote: > On Mon, Dec 26, 2011 at 2:34 PM, Adrian Mercieca <amerci...@gmail.com> > wrote: >> Hi folks, >> >> Would anyone answer me on this please? >> >> To clarify, in Java there is are getAndSet methods on Atomic type >> objects (along with compareAndSet). >> >> I know that in D there is the cas function (equivalent to Java's >> compareAndSet); is there an equivalent D function for Java's getAndSet >> please? >> >> >> Thanks. > >>From Java: > --- > public final boolean getAndSet(boolean newValue) { > for (;;) { > boolean current = get(); > if (compareAndSet(current, newValue)) > return current; > } > } > --- > > getAndSet is just a wrapped version of compareAndSet.
Hi Andrew, It is indeed; should have thought of that. Anyway, thanks for pointing it out. Regards.