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.

Reply via email to