GetAndSet function (corresponding to cas function)

Jonathan M Davis jmdavisProg at gmx.com
Mon Dec 26 14:05:04 PST 2011


On Monday, December 26, 2011 20:34:39 Adrian Mercieca 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?

If it's not in core.atomic, then probably not. It has atomicLoad and 
atomicStore, but I don't see anything that tries to combine the two, assuming 
that that's what you want be getAndSet.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list