4 ms·
> It doesn't need to be strictly increasing some other thread could be making other arbitrary operations We're talking about collating a maximum, by definition
by masklinn 1y ago
> It doesn't need to be strictly increasing some other thread could be making other arbitrary operations
We're talking about collating a maximum, by definition every write to that is an increase.
- gpderetta 1y agoIf you are implementing a library function atomic<T>::fetch_max, you cannot assume that every other thread is also performing a fetch_max on that object. There might be little reason for it, but other operations are allowed so the the sequence of modifications might not be strictly increasing (but then again, it doesn't matter for this specific optimization).