View source code
Display the source code in core/atomic.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
core.atomic.cas
- multiple declarations
Function cas
Stores 'writeThis' to the memory referenced by 'here' if the value referenced by 'here' is equal to 'ifThis'. This operation is both lock-free and atomic.
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V1, V2)
(
T* here,
V1 ifThis,
V2 writeThis
) pure nothrow @nogc @trusted
if (!is(T == shared) && is(T : V1));
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V1, V2)
(
shared(T)* here,
V1 ifThis,
V2 writeThis
) pure nothrow @nogc @trusted
if (!is(T == class) && (is(T : V1) || is(shared(T) : V1)));
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V1, V2)
(
shared(T)* here,
shared(V1) ifThis,
shared(V2) writeThis
) pure nothrow @nogc @trusted
if (is(T == class));
Parameters
Name | Description |
---|---|
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.
Function cas
Stores '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. This operation is both lock-free and atomic.
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V)
(
T* here,
T* ifThis,
V writeThis
) pure nothrow @nogc @trusted
if (!is(T == shared) && !is(V == shared));
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V1, V2)
(
shared(T)* here,
V1* ifThis,
V2 writeThis
) pure nothrow @nogc @trusted
if (!is(T == class) && (is(T : V1) || is(shared(T) : V1)));
bool cas(MemoryOrder succ = MemoryOrder .seq, MemoryOrder fail = MemoryOrder .seq, T, V)
(
shared(T)* here,
shared(T)* ifThis,
shared(V) writeThis
) pure nothrow @nogc @trusted
if (is(T == class));
Parameters
Name | Description |
---|---|
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.
Authors
Sean Kelly, Alex Rønne Petersen, Manu Evans
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.