core.atomic
The atomic module provides basic support for lock-free concurrent programming. License:Boost License 1.0 Authors:
Sean Kelly Source:
core/atomic.d
- HeadUnshared!(T) atomicOp(string op, T, V1)(ref shared T val, V1 mod);
- Performs the binary operation 'op' on val using 'mod' as the modifier.
Parameters:
Returns:val The target variable. mod The modifier to apply.
The result of the operation. - bool cas(T, V1, V2)(shared(T)* here, const V1 ifThis, const V2 writeThis);
- 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.
Parameters:
Returns:here The address of the destination variable. writeThis The value to store. ifThis The comparison value.
true if the store occurred, false if not. - HeadUnshared!(T) atomicLoad(msync ms = msync.seq, T)(ref const shared T val);
- Loads 'val' from memory and returns it. The memory barrier specified
by 'ms' is applied to the operation, which is fully sequenced by
default.
Parameters:
Returns:val The target variable.
The value of 'val'. - void atomicStore(msync ms = msync.seq, T, V1)(ref shared T val, V1 newval);
- Writes 'newval' into 'val'. The memory barrier specified by 'ms' is
applied to the operation, which is fully sequenced by default.
Parameters:
val The target variable. newval The value to store. - enum msync;