Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, that's what Java's "volatile" actually enforces.

C's "volatile" isn't enough, but more recent C compilers have atomics and memory models.

The memory-model problem wasn't solved until the 00s (that late!!!) when multicore CPUs became more commonplace. Java, C++11, and other language / language updates after that point quickly adopted memory models. And the rest is history.

So yeah, use atomics + memory barriers.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: