Imagine N threads running following simple code:
int res = num.fetch_add(1, std::memory_order_relaxed);
where num
is:
std::atomic<int> num = 0;
Is it completelly safe to assume, that res
for each thread running the code will be different or it is possible that it will be the same for some threads?