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(T, V1, V2)
(
shared(T)* here,
const V1 ifThis,
V2 writeThis
) pure nothrow @nogc @safe
if (!is(T == class) && !is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
const shared(V1) ifThis,
shared(V2) writeThis
) pure nothrow @nogc @safe
if (is(T == class) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
const shared(V1)* ifThis,
shared(V2)* writeThis
) pure nothrow @nogc @safe
if (is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
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(T, V1, V2)
(
shared(T)* here,
V1* ifThis,
V2 writeThis
) pure nothrow @nogc @safe
if (!is(T == class) && !is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
shared(V1)* ifThis,
shared(V2) writeThis
) pure nothrow @nogc @safe
if (is(T == class) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
shared(V1)** ifThis,
shared(V2)* writeThis
) pure nothrow @nogc @safe
if (is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
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.
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(T, V1, V2)
(
shared(T)* here,
const V1 ifThis,
V2 writeThis
) pure nothrow @nogc @safe
if (!is(T == class) && !is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
const shared(V1) ifThis,
shared(V2) writeThis
) pure nothrow @nogc @safe
if (is(T == class) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
const shared(V1)* ifThis,
shared(V2)* writeThis
) pure nothrow @nogc @safe
if (is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
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(T, V1, V2)
(
shared(T)* here,
V1* ifThis,
V2 writeThis
) pure nothrow @nogc @safe
if (!is(T == class) && !is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
shared(V1)* ifThis,
shared(V2) writeThis
) pure nothrow @nogc @safe
if (is(T == class) && __traits(compiles, ()
{
*here = writeThis;
}
));
bool cas(T, V1, V2)
(
shared(T)* here,
shared(V1)** ifThis,
shared(V2)* writeThis
) pure nothrow @nogc @safe
if (is(T U : U*) && __traits(compiles, ()
{
*here = writeThis;
}
));
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