sync.atomic ≡
template <typename T, T InitialValue = {}> inline pair<T, T> atomically((T) -> T modify) §source
Atomically apply user specified function to internal state of type
T, returning both old and new state value. Note that a
state is maintained per each call site of this inline function.
Parameters
-
typename TType of the internal state
-
T InitialValue = {}Initial value
template <auto N, typename T, T InitialValue = {}> inline pair<T, T> atomically_one_of(index_t<N> i, (T) -> T modify) §source
Atomically interleave updates among multiple threads to internal
state of type T[N]. Return both old and new element value.
A state is maintained per each call site of this inline function.
Parameters
-
auto NSize of state array. Must be between 2 and 8 inclusive.
-
typename TType of the internal state.
-
T InitialValue = {}Initial value.