Quantcast
Channel: std::atomic - load and reset to 0 atomically? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by AlexD for std::atomic - load and reset to 0 atomically?

std::atomic<int> x = 1;int y = x.exchange(0);

View Article



std::atomic - load and reset to 0 atomically?

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.

View Article
Browsing all 2 articles
Browse latest View live




Latest Images