|
|
|
|
|
by haberman
4803 days ago
|
|
That is not what memory barriers are for, at all. Memory barriers are a sequencing primitive for shared-memory concurrency (an excellent intro is here: http://lxr.linux.no/linux/Documentation/memory-barriers.txt). They are never required for correctness in valid single-threaded programs. The memory barrier "fixed" this program similarly to how a cruise missile "fixes" a termite problem. It was just a coincidence and it was the wrong tool for the job. |
|
A tool doesn't have a purpose. It has capabilities, and understanding why something works (and why it can be relied upon) is all that matters.