- cas
bool cas(T* here, V1 ifThis, V2 writeThis)
Compare-and-set for non-shared values
- cas
bool cas(shared(T)* here, V1 ifThis, V2 writeThis)
Compare-and-set for shared value type
- cas
bool cas(shared(T)* here, shared(V1) ifThis, shared(V2) writeThis)
Compare-and-set for shared reference type (class)
- cas
bool cas(T* here, T* ifThis, V writeThis)
Compare-and-exchange for non-shared types
- cas
bool cas(shared(T)* here, V1* ifThis, V2 writeThis)
Compare and exchange for mixed-sharedness types
- cas
bool cas(shared(T)* here, shared(T)* ifThis, shared(V) writeThis)
Compare-and-exchange for class
Performs either compare-and-set or compare-and-swap (or exchange).
There are two categories of overloads in this template: The first category does a simple compare-and-set. The comparison value (ifThis) is treated as an rvalue.
The second category does a compare-and-swap (a.k.a. compare-and-exchange), and expects ifThis to be a pointer type, where the previous value of here will be written.
This operation is both lock-free and atomic.