Describe what enhancement you'd like to have
we can consider to use relaxed for this pure atomic counter. counter is not related to happen before. this is sufficient.
No ordering constraints, only atomic operations.
That's to say, assume the thread A will increate counter 5 the thread B will increace counter 10.
the final result does not care about the A or B order, right?
https://stackoverflow.com/a/27716387
https://en.cppreference.com/w/cpp/atomic/memory_order#Relaxed_ordering
Describe what enhancement you'd like to have
we can consider to use relaxed for this pure atomic counter. counter is not related to happen before. this is sufficient.
No ordering constraints, only atomic operations.
That's to say, assume the thread A will increate counter 5 the thread B will increace counter 10.
the final result does not care about the A or B order, right?
https://stackoverflow.com/a/27716387
https://en.cppreference.com/w/cpp/atomic/memory_order#Relaxed_ordering