Hacker News new | ask | show | jobs
by akoboldfrying 466 days ago
My immediate thought upon seeing the condmove() example was "Slap ‘volatile‘ on all those local variables". This forces a standards-compliant compiler to reload their values every time they are referenced. Basically, the compiler is no longer allowed to assume that the current thread of execution is the only actor that updates the variable -- any other mechanism (including another thread, but not limited to that -- e.g., a hardware DMA channel) could have modified the variable's value.

That doesn't solve the hardware-JIT-level problem, but it would appear to solve the compiler-level problem.

ETA: I only read up to p. 3, but I did search for the text "volatile" and didn't find it.