casWeak
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V1, V2)(T * here, V1 ifThis, V2 writeThis) if (!is(T == shared) && is(T : V1)) pure nothrow @nogc @trustedStores 'writeThis' to the memory referenced by 'here' if the value referenced by 'here' is equal to 'ifThis'. The 'weak' version of cas may spuriously fail. It is recommended to use casWeak only when cas would be used in a loop. This operation is both lock-free and atomic.
Parameters
here | The address of the destination variable. |
writeThis | The value to store. |
ifThis | The comparison value. |
Returns
true if the store occurred, false if not.
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V1, V2)(shared(T) * here, V1 ifThis, V2 writeThis) if (!is(T == class) && (is(T : V1) || is(shared T : V1))) pure nothrow @nogc @trustedDitto
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V1, V2)(shared(T) * here, shared(V1) ifThis, shared(V2) writeThis) if (is(T == class)) pure nothrow @nogc @trustedDitto
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V)(T * here, T * ifThis, V writeThis) if (!is(T == shared S, S) && !is(V == shared U, U)) pure nothrow @nogc @trustedStores 'writeThis' to the memory referenced by 'here' if the value referenced by 'here' is equal to the value referenced by 'ifThis'. The prior value referenced by 'here' is written to ifThis and returned to the user. The 'weak' version of cas may spuriously fail. It is recommended to use casWeak only when cas would be used in a loop. This operation is both lock-free and atomic.
Parameters
here | The address of the destination variable. |
writeThis | The value to store. |
ifThis | The address of the value to compare, and receives the prior value of here as output. |
Returns
true if the store occurred, false if not.
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V1, V2)(shared(T) * here, V1 * ifThis, V2 writeThis) if (!is(T == class) && (is(T : V1) || is(shared T : V1))) pure nothrow @nogc @trustedDitto
fn
bool casWeak(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T, V)(shared(T) * here, shared(T) * ifThis, shared(V) writeThis) if (is(T == class)) pure nothrow @nogc @trustedDitto