News for hackers. Stuff that matters.
Re:A spin lock in C that does not require a machine level ex... by colin_mccabe on Sunday May 04, 2014 @08:30PM (#7696449)
There seems to be an implicit assumption in this code that writes which one thread makes will be seen by other threads in the same order. This is not the case on modern architectures. You need both compiler and machine-level memory barriers to ensure this. C's "volatile" keyword does not provide either.

The Linux kernel guys wrote an in-depth explanation of why volatile doesn't work for this use-case here: https://www.kernel.org/doc/Documentation/volatile-considered...

There are no comments on this comment yet.