Hacker News new | past | comments | ask | show | jobs | submit login

    volatile
to the rescue!



If by volatile you mean "don't use volatile for this" and "use std::atomic", then I agree completely!


Perhaps azth is writing C?


C has atomic types now also. And I believe in general that volatile only prevents elision of reads and stores, but not optimization in general. That works for many cases (and I think it would work here) but it doesn't solve data races in general.


C11 has atomics which works similarly to C++11's.


Sure but the vast majority of C out there is C89/90/99.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: