Functions | |
void | add (double &target, double value) |
This namespace contains functions that support lock-free programming in a multi-threaded shared memory environment. All implementations are provided inline in the header.
|
inline |
This function adds the specified double value (which can be an expression) to the specified target variable (passed as a reference to a memory location) in a thread-safe manner. The function avoids race conditions between concurrent threads by implementing a classical compare and swap (CAS) loop using the corresponding atomic operation on the target memory location.