3 ms·
You probably know, but for others reading these threads: volatile is not the optimal way (and usually it isn't even a correct way, outside of very specific code
by jjnoakes 10y ago
You probably know, but for others reading these threads: volatile is not the optimal way (and usually it isn't even a correct way, outside of very specific code) to synchronize variables across threads.
- mikeash 10y agoYeah, don't use what I've said as a guide for writing your own stuff. I'm pretty sure I did it right, but you need a lot more understanding of what's going on than what I've explained.... These days, with atomics showing up in the C and C++ standard libraries, there are better ways to do it altogether.