Quantcast
Channel: Read a variable in another thread - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by Phil Miller for Read a variable in another thread

You can indeed just declare it as std::atomic<int>, and things should work as you want.volatile is about preserving the sequence of addresses and values that the generated code must present to...

View Article



Read a variable in another thread

I'm using linux and I have two variable that is read/write in another thread. Once in a while (100ms) ThreadB reads the status of the variables and does something. It's basically a while(1){...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images