Having std::atomic<int>
how can I atomically load value and reset to 0
? So If I do this operation from two threads, only one receive value, another should receive 0
.
std::atomic<int> x = 1;
int y = x.exchange(0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With